#GERMINATION DATA
#VIVIAN BERNAU
#29 September 2017
#UNIVARIATE ANALYSIS
#total viable
#total germ
#t50
#lag time
#germination rate (100/t50)
#germination uniformity (t75-t25)
#Set working directory and repositories
wd <- ("~/Google Drive/RFiles/chile-germination/")
src.dir <- paste(wd,"scripts", sep = "")
data.dir <- paste (wd,"data", sep = "")
out.dir <- paste(wd, "output", sep ="")
setwd(out.dir)
#read in germination data in pre-lifetab format
#df <- read.csv(paste(out.dir, "/cleaned_2017-09-17.csv", sep = ""), header = T)
df <- read.csv(paste(out.dir, "/cleaned8_2017-10-13.csv", sep = ""), header = T)
str(df)
## 'data.frame': 10773 obs. of 24 variables:
## $ X.2 : int 1 3 8 17 31 36 42 56 58 59 ...
## $ X.1 : int 1 3 8 17 31 36 42 56 58 59 ...
## $ sampleid : Factor w/ 76 levels "CanAbasolo1",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ line : Factor w/ 120 levels "100-1","100-2",..: 96 96 96 96 96 96 96 96 96 96 ...
## $ X : num 915 913 3081 914 917 ...
## $ rep : int 1 1 2 1 1 2 2 2 1 2 ...
## $ run : int 1 1 3 1 1 3 3 3 1 3 ...
## $ shelf : int 7 7 5 7 7 5 5 3 7 5 ...
## $ plate : int 237 237 170 237 237 170 170 78 237 170 ...
## $ trt : int 10 10 10 10 10 10 10 20 10 10 ...
## $ end : num 246 102 158 151 542 ...
## $ status : int 1 1 1 1 0 1 1 0 0 0 ...
## $ viable : int 1 1 1 1 1 1 1 0 0 0 ...
## $ number : int 1 4 6 1 2 2 2 2 1 1 ...
## $ pedigree : Factor w/ 119 levels "14CAg128-1","14CAg128-2",..: 45 45 45 45 45 45 45 45 45 45 ...
## $ planting.date : Factor w/ 1 level "11/10/14": 1 1 1 1 1 1 1 1 1 1 ...
## $ landrace.abb : Factor w/ 22 levels "CAg","Cam","CdA",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ region : Factor w/ 5 levels "central valleys",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ pop : Factor w/ 37 levels "","CAg_24","CAg_25",..: 10 10 10 10 10 10 10 10 10 10 ...
## $ population.type: Factor w/ 4 levels "","landrace",..: 2 2 2 2 2 2 2 2 2 2 ...
## $ landrace.name : Factor w/ 19 levels "","Chigole","Chile Bolita",..: 4 4 4 4 4 4 4 4 4 4 ...
## $ cultivation : Factor w/ 5 levels "","Backyard",..: 4 4 4 4 4 4 4 4 4 4 ...
## $ main.use : Factor w/ 4 levels "","Dry","Fresh",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ uniqueplate : Factor w/ 1084 levels "1_1","1_10","1_100",..: 84 84 423 84 84 423 423 524 84 423 ...
#extract values for viable seed and germinated seed per plate
viable <- aggregate(df$viable, by=list(df$uniqueplate), FUN=sum)
colnames(viable) <- c("uniqueplate", "viable")
germ <- aggregate(df$status, by = list(df$uniqueplate), FUN = sum)
colnames(germ) <- c("uniqueplate", "germ")
summary <- merge(viable, germ, by.x = "uniqueplate")
rm(germ, viable)
#calculate percent germ and percent viable
summary$perc_germ <- summary$germ/summary$viable
summary$perc_viable <- summary$viable/10
#calculate delay to first germ (first data point per plate)
delay <- aggregate(df$end ~ df$uniqueplate, FUN = min)
colnames(delay) <- c("uniqueplate", "delay")
summary$delay <- delay$delay
#calculate germination rate
#at which time point is the sum of end > germ50?
summary$germ50 <- .5*summary$viable
df <- df[order(df$end, (df$plate), (df$run)),]
plates <- split(df, df$uniqueplate)
for(i in seq_along(plates)){
x <- cumsum(plates[[i]][,"status"])
plates[[i]]$cumsum <- x
}
plates[[2]]$cumsum #confirm loop was successful
## [1] 1 2 3 4 5 6 7 8 8 8
min(plates[[1]]$end[plates[[1]]$cumsum >= summary$germ50[1]])
## [1] 101.9
n <- nrow(summary)
out50 <- vector("list", n)
for(i in seq_along(plates)){
x<- min(plates[[i]]$end[
plates[[i]]$cumsum >= summary$germ50[[i]]])
out50[[i]] <- x
}
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ50[[i]]]):
## no non-missing arguments to min; returning Inf
summary$t50 <- t(as.data.frame(out50))
#calculate germation uniformity
summary$germ25 <- .25*summary$viable
out25 <- vector("list", n)
for(i in seq_along(plates)){
x<- min(plates[[i]]$end[
plates[[i]]$cumsum >= summary$germ25[[i]]])
out25[[i]] <- x
}
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ25[[i]]]):
## no non-missing arguments to min; returning Inf
summary$t25 <- t(as.data.frame(out25))
summary$germ75 <- .75*summary$viable
out75 <- vector("list", n)
for(i in seq_along(plates)){
x<- min(plates[[i]]$end[
plates[[i]]$cumsum >= summary$germ75[[i]]])
out75[[i]] <- x
}
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
## Warning in min(plates[[i]]$end[plates[[i]]$cumsum >= summary$germ75[[i]]]):
## no non-missing arguments to min; returning Inf
summary$t75 <- t(as.data.frame(out75))
#calculuate germ rate and uniformity
summary$rategerm <- 1/summary$t50
summary$uniform <- summary$t75-summary$t25
#merge summary statistics with descriptive datasets
sum <- merge(summary, df, by = "uniqueplate", all.x = T)
sum = sum[!duplicated(sum$uniqueplate),]
sum$run <- as.factor(sum$run)
sum$rep <- as.factor(sum$rep)
sum$trt <- as.factor(sum$trt)
is.na(sum) <- sapply(sum, is.infinite)
sum <- sum[!(is.na(sum$landrace.name)) | !(is.na(sum$region)) | !(is.na(sum$cultivation)),]
sum0 <- subset(sum, sum$perc_germ!=0)
#write.csv(summary, file = paste(data.dir, "/summarydata_2018-01-23.csv", sep = ""))
#distribution plots
plots <- subset(sum[,c("perc_germ", "delay", "uniform", "rategerm")])
str(plots)
## 'data.frame': 1045 obs. of 4 variables:
## $ perc_germ: num 0.9 1 0.7 1 0.1 0.875 0.9 1 1 0.875 ...
## $ delay : num 102 102 150 102 438 ...
## $ uniform : num [1:1045, 1] 48.4 48.4 NA 0 NaN ...
## ..- attr(*, "dimnames")=List of 2
## .. ..$ : chr "X150.3" "X150.3.1" "Inf." "X102" ...
## .. ..$ : NULL
## $ rategerm : num [1:1045, 1] 0.00981 0.00665 0.00665 0.0098 0 ...
## ..- attr(*, "dimnames")=List of 2
## .. ..$ : chr "X101.9" "X150.3" "X150.4" "X102" ...
## .. ..$ : NULL
plots$rategerm <- as.vector((plots$rategerm))
plots$uniform <- as.vector((plots$uniform))
str(plots)
## 'data.frame': 1045 obs. of 4 variables:
## $ perc_germ: num 0.9 1 0.7 1 0.1 0.875 0.9 1 1 0.875 ...
## $ delay : num 102 102 150 102 438 ...
## $ uniform : num 48.4 48.4 NA 0 NaN ...
## $ rategerm : num 0.00981 0.00665 0.00665 0.0098 0 ...
plots <- na.omit(plots)
library(ggplot2)
library(reshape2)
ggplot(melt(plots),aes(x=value)) + geom_histogram() + facet_wrap(~variable, scales = "free_x") + stat_function(fun=dnorm)
## No id variables; using all as measure variables
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

plot.new()
par(mfrow=c(2,2))
X = na.omit(plots$delay)
h<-hist(X, breaks=20, col="GREY", xlab="delay",
main="Histogram of observations")
xfit<-seq(min(X),max(X),length=40)
yfit<-dnorm(xfit,mean=mean(X),sd=sd(X))
yfit <- yfit*diff(h$mids[1:2])*length(X)
lines(xfit, yfit, col="4", lwd=2)
X = na.omit(plots$uniform)
h<-hist(X, breaks=20, col="GREY", xlab="uniformity",
main="Histogram of observations")
xfit<-seq(min(X),max(X),length=40)
yfit<-dnorm(xfit,mean=mean(X),sd=sd(X))
yfit <- yfit*diff(h$mids[1:2])*length(X)
lines(xfit, yfit, col="4", lwd=2)
X = na.omit(plots$rategerm)
h<-hist(X, breaks=20, col="GREY", xlab="rate of germination",
main="Histogram of observations")
xfit<-seq(min(X),max(X),length=40)
yfit<-dnorm(xfit,mean=mean(X),sd=sd(X))
yfit <- yfit*diff(h$mids[1:2])*length(X)
lines(xfit, yfit, col="4", lwd=2)
X = na.omit(plots$perc_germ)
h<-hist(X, breaks=20, col="GREY", xlab="rate of germination",
main="Histogram of observations")
xfit<-seq(min(X),max(X),length=40)
yfit<-dnorm(xfit,mean=mean(X),sd=sd(X))
yfit <- yfit*diff(h$mids[1:2])*length(X)
lines(xfit, yfit, col="4", lwd=2)

#test for homogeneity of data (p>0.05 == data is homogenous)
bartlett.test(sum$delay~sum$trt)
##
## Bartlett test of homogeneity of variances
##
## data: sum$delay by sum$trt
## Bartlett's K-squared = 323.43, df = 3, p-value < 2.2e-16
plot(sum$trt, sum$delay, ylab = "delay")
bartlett.test(sum$uniform~sum$trt)
##
## Bartlett test of homogeneity of variances
##
## data: sum$uniform by sum$trt
## Bartlett's K-squared = 17.018, df = 3, p-value = 0.0007007
plot(sum$trt, sum$uniform, ylab = "uniform")
bartlett.test(sum$rategerm~sum$trt)
##
## Bartlett test of homogeneity of variances
##
## data: sum$rategerm by sum$trt
## Bartlett's K-squared = 38.915, df = 3, p-value = 1.809e-08
plot(sum$trt, sum$rategerm, ylab = "rategerm")
bartlett.test(sum$perc_germ~sum$trt)
##
## Bartlett test of homogeneity of variances
##
## data: sum$perc_germ by sum$trt
## Bartlett's K-squared = 467.15, df = 3, p-value < 2.2e-16
plot(sum$trt, sum$perc_germ, ylab = "percnotgerm")

library(lme4)
## Loading required package: Matrix
library(lmerTest)
##
## Attaching package: 'lmerTest'
## The following object is masked from 'package:lme4':
##
## lmer
## The following object is masked from 'package:stats':
##
## step
library(multcomp)
## Loading required package: mvtnorm
## Loading required package: survival
## Loading required package: TH.data
## Loading required package: MASS
##
## Attaching package: 'TH.data'
## The following object is masked from 'package:MASS':
##
## geyser
library(afex)
## Loading required package: emmeans
##
## Attaching package: 'emmeans'
## The following object is masked from 'package:lmerTest':
##
## lsmeans
## ************
## Welcome to afex. For support visit: http://afex.singmann.science/
## - Functions for ANOVAs: aov_car(), aov_ez(), and aov_4()
## - Methods for calculating p-values with mixed(): 'KR', 'S', 'LRT', and 'PB'
## - 'afex_aov' and 'mixed' objects can be passed to emmeans() for follow-up tests
## - Get and set global package options with: afex_options()
## - Set orthogonal sum-to-zero contrasts globally: set_sum_contrasts()
## - For example analyses see: browseVignettes("afex")
## ************
##
## Attaching package: 'afex'
## The following object is masked from 'package:lme4':
##
## lmer
library(lattice)
library(pbkrtest)
options(lmerControl=list(check.nobs.vs.rankZ = "warning",
check.nobs.vs.nlev = "warning",
check.nobs.vs.nRE = "ignore",
check.nlev.gtreq.5 = "warning",
check.nlev.gtr.1 = "warning"))
#a1 <- analysis by region, without including cultivation
#a2 <- analysis by region, cultivation included
#b1 <- analysis by cultivation, region not included
#b2 <- analysis by cultivation, region included
#####
#DELAY
#####
delay.a1 <- lmer(delay ~ trt + (1|region) + (trt|region) + (1|region:landrace.name) + (1|cultivation) + (0+trt|region:landrace.name)
+ (1|rep) + (1|rep:run), data = sum, REML = T)
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
summary(delay.a1)
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Error in calculation of the Satterthwaite's approximation. The output of lme4 package is returned
## summary from lme4 is returned
## some computational error has occurred in lmerTest
## Linear mixed model fit by REML ['lmerMod']
## Formula:
## delay ~ trt + (1 | region) + (trt | region) + (1 | region:landrace.name) +
## (1 | cultivation) + (0 + trt | region:landrace.name) + (1 |
## rep) + (1 | rep:run)
## Data: sum
##
## REML criterion at convergence: 11783.1
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.9887 -0.5234 -0.1373 0.3759 6.2008
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## region.landrace.name trt0 0.000 0.000
## trt10 452.208 21.265 NaN
## trt15 2207.531 46.984 NaN 0.91
## trt20 5612.004 74.913 NaN 1.00 0.92
## region.landrace.name.1 (Intercept) 7.471 2.733
## rep.run (Intercept) 144.022 12.001
## cultivation (Intercept) 1240.921 35.227
## region (Intercept) 106.872 10.338
## trt10 12.477 3.532 1.00
## trt15 302.655 17.397 1.00 1.00
## trt20 1707.455 41.321 1.00 1.00 1.00
## region.1 (Intercept) 0.000 0.000
## rep (Intercept) 64.911 8.057
## Residual 4305.877 65.619
## Number of obs: 1045, groups:
## region:landrace.name, 22; rep:run, 8; cultivation, 5; region, 5; rep, 4
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 153.7759 18.6284 8.255
## trt10 0.4143 7.5928 0.055
## trt15 23.3288 14.8862 1.567
## trt20 119.1624 26.9333 4.424
##
## Correlation of Fixed Effects:
## (Intr) trt10 trt15
## trt10 -0.062
## trt15 0.082 0.669
## trt20 0.156 0.643 0.870
## convergence code: 0
## unable to evaluate scaled gradient
## Model failed to converge: degenerate Hessian with 1 negative eigenvalues
anova(delay.a1) #trt significant at p = 0.0047
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Error in calculation of the Satterthwaite's approximation. The output of lme4 package is returned
## anova from lme4 is returned
## some computational error has occurred in lmerTest
## Analysis of Variance Table
## Df Sum Sq Mean Sq F value
## trt 3 201165 67055 15.573
anova(delay.a1, ddf = "Kenward-Roger")
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning in pf(FstatU, df1 = q, df2 = df2, lower.tail = FALSE): NaNs
## produced
## Warning in pf(Fstat, df1 = q, df2 = df2, lower.tail = FALSE): NaNs produced
## Analysis of Variance Table of type III with Kenward-Roger
## approximation for degrees of freedom
## Sum Sq Mean Sq NumDF DenDF F.value Pr(>F)
## trt -3464.4 -1154.8 3 -0.067071 -0.27011
rand(delay.a1) #trt:region:landrace significant at p<0.001, run within rep significnat at p = 0.008
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 2 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Analysis of Random effects Table:
## Chi.sq Chi.DF p.value
## region 0.000 1 1.00
## trt:region 5.833 10 0.83
## region:landrace.name 3.220 1 0.07 .
## cultivation 0.000 1 1.00
## trt:region:landrace.name 61.414 10 2e-09 ***
## rep 0.257 1 0.61
## rep:run 0.000 1 1.00
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(residuals(delay.a1))
hist(residuals(delay.a1))
plot(fitted(delay.a1), residuals(delay.a1))
qqnorm(resid(delay.a1)) #check normal distribution of residuals
qqline(resid(delay.a1)) #heavy tails

ranef<- ranef(delay.a1, condVar = T) #extract conditional means
## Warning in ranef.merMod(delay.a1, condVar = T): conditional variances not
## currently available via ranef when there are multiple terms per factor
ranef
## $`region:landrace.name`
## trt0 trt10 trt15 trt20
## central valleys:Chile de Agua 0 -10.198924 -8.212854 -34.60968
## central valleys:Taviche 0 -5.466359 -14.423837 -19.61974
## central valleys:Tusta 0 4.287902 16.389565 15.93183
## ecoast: 0 22.967053 46.193505 80.89473
## ecoast:Chigole 0 -22.208112 -53.218246 -79.13442
## ecoast:Chile Bolita 0 -9.011951 -29.818510 -32.99017
## ecoast:Chile de Monte 0 9.725084 26.525464 34.99733
## ecoast:Costeno Rojo 0 -27.350308 -34.979162 -94.19523
## ecoast:Frutescens 0 -9.551338 -30.389384 -34.83513
## ecoast:Guajillo 0 38.176663 99.922977 136.93616
## ecoast:Guina Dahni 0 -9.341729 -27.185736 -33.79986
## ecoast:Mareno 0 21.851469 55.974449 78.24905
## ecoast:Mirasol 0 5.941083 -7.407229 18.85943
## ecoast:Payaso 0 -22.398227 -47.230797 -79.12407
## ecoast:Solterito 0 36.325327 76.456384 128.30781
## ecoast:Tusta 0 -5.769233 -6.647915 -19.79141
## sierra madre:Tusta 0 -15.793194 -37.466061 -56.23552
## wcoast:Costeno Amarillo 0 -12.289400 -22.163595 -43.01318
## wcoast:Costeno Rojo 0 -9.436373 -11.586027 -32.44763
## wcoast:Piquin 0 19.173058 30.420383 66.66230
## yucatan:Dulce 0 -21.511207 -45.085878 -75.96128
## yucatan:Paradito 0 21.878717 23.932506 74.91870
## (Intercept)
## central valleys:Chile de Agua 0.01949057
## central valleys:Taviche 0.05510658
## central valleys:Tusta 0.47505122
## ecoast: 0.38654957
## ecoast:Chigole -0.40140358
## ecoast:Chile Bolita -0.83638928
## ecoast:Chile de Monte 0.21078594
## ecoast:Costeno Rojo 0.29716263
## ecoast:Frutescens 0.08302204
## ecoast:Guajillo 0.48881308
## ecoast:Guina Dahni -0.52350690
## ecoast:Mareno -0.18744053
## ecoast:Mirasol 0.64824405
## ecoast:Payaso -0.45456030
## ecoast:Solterito 0.25700487
## ecoast:Tusta 0.34664926
## sierra madre:Tusta -0.18515080
## wcoast:Costeno Amarillo -0.29932185
## wcoast:Costeno Rojo -0.72317963
## wcoast:Piquin 0.33050389
## yucatan:Dulce -0.43970531
## yucatan:Paradito 0.45227448
##
## $`rep:run`
## (Intercept)
## 1:1 14.561927
## 1:2 2.097066
## 2:3 5.147769
## 2:4 -9.256859
## 3:5 -6.117885
## 3:6 -3.823285
## 4:7 10.345493
## 4:8 -12.954226
##
## $cultivation
## (Intercept)
## 33.449926
## Backyard -5.527517
## Forest 35.009022
## Milpa -32.893476
## Plantation -30.037956
##
## $region
## (Intercept) trt10 trt15 trt20 (Intercept)
## central valleys -3.601816 -1.2307026 -6.061273 -14.39675 0
## ecoast 12.743616 4.3543597 21.445444 50.93726 0
## sierra madre -2.847776 -0.9730552 -4.792347 -11.38279 0
## wcoast -8.848260 -3.0233575 -14.890190 -35.36721 0
## yucatan 2.554236 0.8727557 4.298366 10.20949 0
##
## $rep
## (Intercept)
## 1 7.508222
## 2 -1.851970
## 3 -4.480494
## 4 -1.175758
dotplot(ranef)
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## $`region:landrace.name`

##
## $`rep:run`

##
## $cultivation

##
## $region

##
## $rep

which(residuals(delay.a1) > 200)
## 551 680 910 1069 1369 1479 1499 2269 2838 3068 3228 5034
## 53 66 88 104 132 143 145 220 274 297 313 487
## 5591 7153 7268 7540 8270 8900 9009 9039 10326 10396
## 539 692 704 731 799 861 872 875 1002 1008
delay.a2 <- lmer(delay ~ trt + (1|region) + (trt|region) + (1|region:landrace.name) + (1|cultivation) + (0+trt|region:landrace.name)
+ (1|rep) + (1|rep:run), data = sum, REML = T)
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
summary(delay.a2)
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Error in calculation of the Satterthwaite's approximation. The output of lme4 package is returned
## summary from lme4 is returned
## some computational error has occurred in lmerTest
## Linear mixed model fit by REML ['lmerMod']
## Formula:
## delay ~ trt + (1 | region) + (trt | region) + (1 | region:landrace.name) +
## (1 | cultivation) + (0 + trt | region:landrace.name) + (1 |
## rep) + (1 | rep:run)
## Data: sum
##
## REML criterion at convergence: 11783.1
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.9887 -0.5234 -0.1373 0.3759 6.2008
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## region.landrace.name trt0 0.000 0.000
## trt10 452.208 21.265 NaN
## trt15 2207.531 46.984 NaN 0.91
## trt20 5612.004 74.913 NaN 1.00 0.92
## region.landrace.name.1 (Intercept) 7.471 2.733
## rep.run (Intercept) 144.022 12.001
## cultivation (Intercept) 1240.921 35.227
## region (Intercept) 106.872 10.338
## trt10 12.477 3.532 1.00
## trt15 302.655 17.397 1.00 1.00
## trt20 1707.455 41.321 1.00 1.00 1.00
## region.1 (Intercept) 0.000 0.000
## rep (Intercept) 64.911 8.057
## Residual 4305.877 65.619
## Number of obs: 1045, groups:
## region:landrace.name, 22; rep:run, 8; cultivation, 5; region, 5; rep, 4
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 153.7759 18.6284 8.255
## trt10 0.4143 7.5928 0.055
## trt15 23.3288 14.8862 1.567
## trt20 119.1624 26.9333 4.424
##
## Correlation of Fixed Effects:
## (Intr) trt10 trt15
## trt10 -0.062
## trt15 0.082 0.669
## trt20 0.156 0.643 0.870
## convergence code: 0
## unable to evaluate scaled gradient
## Model failed to converge: degenerate Hessian with 1 negative eigenvalues
anova(delay.a2) #trt significant at p = 0.0047
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Error in calculation of the Satterthwaite's approximation. The output of lme4 package is returned
## anova from lme4 is returned
## some computational error has occurred in lmerTest
## Analysis of Variance Table
## Df Sum Sq Mean Sq F value
## trt 3 201165 67055 15.573
anova(delay.a2, ddf = "Kenward-Roger")
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning in pf(FstatU, df1 = q, df2 = df2, lower.tail = FALSE): NaNs
## produced
## Warning in pf(Fstat, df1 = q, df2 = df2, lower.tail = FALSE): NaNs produced
## Analysis of Variance Table of type III with Kenward-Roger
## approximation for degrees of freedom
## Sum Sq Mean Sq NumDF DenDF F.value Pr(>F)
## trt -3464.4 -1154.8 3 -0.067071 -0.27011
rand(delay.a2) #trt:region:landrace significant at p<0.001, run within rep significnat at p = 0.008
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 2 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Analysis of Random effects Table:
## Chi.sq Chi.DF p.value
## region 0.000 1 1.00
## trt:region 5.833 10 0.83
## region:landrace.name 3.220 1 0.07 .
## cultivation 0.000 1 1.00
## trt:region:landrace.name 61.414 10 2e-09 ***
## rep 0.257 1 0.61
## rep:run 0.000 1 1.00
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(residuals(delay.a2))
hist(residuals(delay.a2))
plot(fitted(delay.a2), residuals(delay.a2))
qqnorm(resid(delay.a2)) #check normal distribution of residuals
qqline(resid(delay.a2)) #heavy tails

ranef<- ranef(delay.a2, condVar = T) #extract conditional means
## Warning in ranef.merMod(delay.a2, condVar = T): conditional variances not
## currently available via ranef when there are multiple terms per factor
ranef
## $`region:landrace.name`
## trt0 trt10 trt15 trt20
## central valleys:Chile de Agua 0 -10.198924 -8.212854 -34.60968
## central valleys:Taviche 0 -5.466359 -14.423837 -19.61974
## central valleys:Tusta 0 4.287902 16.389565 15.93183
## ecoast: 0 22.967053 46.193505 80.89473
## ecoast:Chigole 0 -22.208112 -53.218246 -79.13442
## ecoast:Chile Bolita 0 -9.011951 -29.818510 -32.99017
## ecoast:Chile de Monte 0 9.725084 26.525464 34.99733
## ecoast:Costeno Rojo 0 -27.350308 -34.979162 -94.19523
## ecoast:Frutescens 0 -9.551338 -30.389384 -34.83513
## ecoast:Guajillo 0 38.176663 99.922977 136.93616
## ecoast:Guina Dahni 0 -9.341729 -27.185736 -33.79986
## ecoast:Mareno 0 21.851469 55.974449 78.24905
## ecoast:Mirasol 0 5.941083 -7.407229 18.85943
## ecoast:Payaso 0 -22.398227 -47.230797 -79.12407
## ecoast:Solterito 0 36.325327 76.456384 128.30781
## ecoast:Tusta 0 -5.769233 -6.647915 -19.79141
## sierra madre:Tusta 0 -15.793194 -37.466061 -56.23552
## wcoast:Costeno Amarillo 0 -12.289400 -22.163595 -43.01318
## wcoast:Costeno Rojo 0 -9.436373 -11.586027 -32.44763
## wcoast:Piquin 0 19.173058 30.420383 66.66230
## yucatan:Dulce 0 -21.511207 -45.085878 -75.96128
## yucatan:Paradito 0 21.878717 23.932506 74.91870
## (Intercept)
## central valleys:Chile de Agua 0.01949057
## central valleys:Taviche 0.05510658
## central valleys:Tusta 0.47505122
## ecoast: 0.38654957
## ecoast:Chigole -0.40140358
## ecoast:Chile Bolita -0.83638928
## ecoast:Chile de Monte 0.21078594
## ecoast:Costeno Rojo 0.29716263
## ecoast:Frutescens 0.08302204
## ecoast:Guajillo 0.48881308
## ecoast:Guina Dahni -0.52350690
## ecoast:Mareno -0.18744053
## ecoast:Mirasol 0.64824405
## ecoast:Payaso -0.45456030
## ecoast:Solterito 0.25700487
## ecoast:Tusta 0.34664926
## sierra madre:Tusta -0.18515080
## wcoast:Costeno Amarillo -0.29932185
## wcoast:Costeno Rojo -0.72317963
## wcoast:Piquin 0.33050389
## yucatan:Dulce -0.43970531
## yucatan:Paradito 0.45227448
##
## $`rep:run`
## (Intercept)
## 1:1 14.561927
## 1:2 2.097066
## 2:3 5.147769
## 2:4 -9.256859
## 3:5 -6.117885
## 3:6 -3.823285
## 4:7 10.345493
## 4:8 -12.954226
##
## $cultivation
## (Intercept)
## 33.449926
## Backyard -5.527517
## Forest 35.009022
## Milpa -32.893476
## Plantation -30.037956
##
## $region
## (Intercept) trt10 trt15 trt20 (Intercept)
## central valleys -3.601816 -1.2307026 -6.061273 -14.39675 0
## ecoast 12.743616 4.3543597 21.445444 50.93726 0
## sierra madre -2.847776 -0.9730552 -4.792347 -11.38279 0
## wcoast -8.848260 -3.0233575 -14.890190 -35.36721 0
## yucatan 2.554236 0.8727557 4.298366 10.20949 0
##
## $rep
## (Intercept)
## 1 7.508222
## 2 -1.851970
## 3 -4.480494
## 4 -1.175758
dotplot(ranef)
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## $`region:landrace.name`

##
## $`rep:run`

##
## $cultivation

##
## $region

##
## $rep

which(residuals(delay.a2) > 200)
## 551 680 910 1069 1369 1479 1499 2269 2838 3068 3228 5034
## 53 66 88 104 132 143 145 220 274 297 313 487
## 5591 7153 7268 7540 8270 8900 9009 9039 10326 10396
## 539 692 704 731 799 861 872 875 1002 1008
delay.b1 <- lmer(delay ~ trt + (1|cultivation) + (trt|cultivation) + (1|cultivation:landrace.name) +(1|region)+ (0+trt|cultivation:landrace.name)
+ (1|rep) + (1|rep:run), data = sum, REML = T, na.action = na.omit)
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
summary(delay.b1)
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Error in calculation of the Satterthwaite's approximation. The output of lme4 package is returned
## summary from lme4 is returned
## some computational error has occurred in lmerTest
## Linear mixed model fit by REML ['lmerMod']
## Formula: delay ~ trt + (1 | cultivation) + (trt | cultivation) + (1 |
## cultivation:landrace.name) + (1 | region) + (0 + trt | cultivation:landrace.name) +
## (1 | rep) + (1 | rep:run)
## Data: sum
##
## REML criterion at convergence: 11772.6
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.0439 -0.5361 -0.1174 0.3525 6.1959
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## cultivation.landrace.name trt0 0.000e+00 0.000e+00
## trt10 2.515e+02 1.586e+01 NaN
## trt15 1.940e+03 4.405e+01 NaN 1.00
## trt20 4.063e+03 6.375e+01 NaN 1.00
## cultivation.landrace.name.1 (Intercept) 6.406e+01 8.003e+00
## rep.run (Intercept) 1.306e+02 1.143e+01
## region (Intercept) 1.247e+02 1.117e+01
## cultivation (Intercept) 1.330e+03 3.647e+01
## trt10 6.085e+01 7.800e+00 0.70
## trt15 2.049e+02 1.431e+01 0.87 0.96
## trt20 3.370e+03 5.805e+01 0.86 0.97
## cultivation.1 (Intercept) 8.878e-10 2.980e-05
## rep (Intercept) 7.315e+01 8.553e+00
## Residual 4.286e+03 6.547e+01
##
##
##
##
## 1.00
##
##
##
##
##
##
## 1.00
##
##
##
## Number of obs: 1045, groups:
## cultivation:landrace.name, 23; rep:run, 8; region, 5; cultivation, 5; rep, 4
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 152.2022 19.2407 7.910
## trt10 0.0898 7.5787 0.012
## trt15 30.5996 13.0775 2.340
## trt20 138.5150 30.7778 4.500
##
## Correlation of Fixed Effects:
## (Intr) trt10 trt15
## trt10 0.156
## trt15 0.294 0.732
## trt20 0.603 0.681 0.803
## convergence code: 0
## unable to evaluate scaled gradient
## Model failed to converge: degenerate Hessian with 1 negative eigenvalues
anova(delay.b1) #trt not significant
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Error in calculation of the Satterthwaite's approximation. The output of lme4 package is returned
## anova from lme4 is returned
## some computational error has occurred in lmerTest
## Analysis of Variance Table
## Df Sum Sq Mean Sq F value
## trt 3 161928 53976 12.593
rand(delay.b1) #trt:cultivation:landrace significant at p < 0.001
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Analysis of Random effects Table:
## Chi.sq Chi.DF p.value
## cultivation 0.000 1 1.00
## trt:cultivation 13.471 10 0.20
## cultivation:landrace.name 0.486 1 0.49
## region 2.778 1 0.10 .
## trt:cultivation:landrace.name 51.531 10 1e-07 ***
## rep 0.000 1 1.00
## rep:run 3.766 1 0.05 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot.new()
plot(residuals(delay.b1))
hist(residuals(delay.b1))
plot(fitted(delay.b1), residuals(delay.b1))

qqnorm(resid(delay.b1)) #check normal distribution of residuals
qqline(resid(delay.b1)) #heavy tails
ranef<- ranef(delay.b1, condVar = T) #extract conditional means
## Warning in ranef.merMod(delay.b1, condVar = T): conditional variances not
## currently available via ranef when there are multiple terms per factor
ranef
## $`cultivation:landrace.name`
## trt0 trt10 trt15 trt20
## : 0 17.8644949 49.619842 71.806523
## :Tusta 0 -25.5423060 -70.945481 -102.667565
## Backyard:Chigole 0 -21.5320202 -59.806641 -86.548179
## Backyard:Chile Bolita 0 -10.4763256 -29.098702 -42.109699
## Backyard:Frutescens 0 -12.6426785 -35.115894 -50.817378
## Backyard:Guajillo 0 30.1796974 83.826149 121.307607
## Backyard:Mareno 0 16.8715369 46.861834 67.815318
## Backyard:Mirasol 0 -2.6801324 -7.444249 -10.772820
## Backyard:Paradito 0 3.7704301 10.472624 15.155283
## Backyard:Piquin 0 -5.6115636 -15.586497 -22.555738
## Backyard:Solterito 0 26.4667919 73.513303 106.383545
## Backyard:Tusta 0 -13.3489120 -37.077505 -53.656090
## Forest:Chile de Monte 0 8.2985407 23.049757 33.356070
## Milpa:Chile de Agua 0 -7.3990406 -20.551335 -29.740521
## Milpa:Costeno Rojo 0 -9.1593223 -25.440637 -36.815991
## Milpa:Dulce 0 -7.3053823 -20.291193 -29.364060
## Milpa:Payaso 0 -3.1623162 -8.783547 -12.710963
## Milpa:Taviche 0 -1.4494236 -4.025872 -5.825973
## Milpa:Tusta 0 16.5143196 45.869639 66.379479
## Plantation:Chile de Agua 0 -0.8008106 -2.224306 -3.218867
## Plantation:Costeno Amarillo 0 -6.6353650 -18.430175 -26.670919
## Plantation:Costeno Rojo 0 -2.4047962 -6.679484 -9.666103
## Plantation:Guina Dahni 0 10.1845837 28.288370 40.937040
## (Intercept)
## : 3.64909946
## :Tusta -1.02531167
## Backyard:Chigole -4.66497588
## Backyard:Chile Bolita -7.96111519
## Backyard:Frutescens 0.20498904
## Backyard:Guajillo 2.89869475
## Backyard:Mareno -2.18751617
## Backyard:Mirasol 4.02534148
## Backyard:Paradito 2.51393251
## Backyard:Piquin 2.16458589
## Backyard:Solterito 1.53366261
## Backyard:Tusta -1.95059905
## Forest:Chile de Monte 2.26463026
## Milpa:Chile de Agua 0.01031879
## Milpa:Costeno Rojo -0.27814170
## Milpa:Dulce -2.82960973
## Milpa:Payaso -2.68706694
## Milpa:Taviche 0.29083123
## Milpa:Tusta 5.37612917
## Plantation:Chile de Agua 0.99411371
## Plantation:Costeno Amarillo -1.70804001
## Plantation:Costeno Rojo 2.05234535
## Plantation:Guina Dahni -2.68629791
##
## $`rep:run`
## (Intercept)
## 1:1 13.701983
## 1:2 1.200713
## 2:3 5.446777
## 2:4 -8.316762
## 3:5 -5.305218
## 3:6 -4.127765
## 4:7 9.451496
## 4:8 -12.051225
##
## $region
## (Intercept)
## central valleys 0.5027801
## ecoast 12.5922233
## sierra madre -1.9965520
## wcoast -10.4837447
## yucatan -0.6147067
##
## $cultivation
## (Intercept) trt10 trt15 trt20 (Intercept)
## 33.259289 3.064175 8.967764 35.21140 3.636481e-11
## Backyard 4.057958 7.299000 9.787366 41.21696 -4.744161e-11
## Forest 33.230750 4.029348 10.174964 40.34095 3.138700e-11
## Milpa -34.349568 -7.436722 -14.624556 -59.14202 -1.629053e-12
## Plantation -36.198430 -6.955801 -14.305539 -57.62728 -1.868114e-11
##
## $rep
## (Intercept)
## 1 8.346124
## 2 -1.607310
## 3 -5.282859
## 4 -1.455955
dotplot(ranef)
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## $`cultivation:landrace.name`
##
## $`rep:run`
##
## $region
##
## $cultivation
##
## $rep
which(residuals(delay.b1) > 300)
## 910 3228 7153 8270 9039
## 88 313 692 799 875
which(residuals(delay.b1) < -200)
## named integer(0)
delay.b2 <- lmer(delay ~ trt + (1|cultivation) + (trt|cultivation) + (1|cultivation:landrace.name) +(1|region)+ (0+trt|cultivation:landrace.name)
+ (1|rep) + (1|rep:run), data = sum, REML = T, na.action = na.omit)
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
summary(delay.b2)
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Error in calculation of the Satterthwaite's approximation. The output of lme4 package is returned
## summary from lme4 is returned
## some computational error has occurred in lmerTest
## Linear mixed model fit by REML ['lmerMod']
## Formula: delay ~ trt + (1 | cultivation) + (trt | cultivation) + (1 |
## cultivation:landrace.name) + (1 | region) + (0 + trt | cultivation:landrace.name) +
## (1 | rep) + (1 | rep:run)
## Data: sum
##
## REML criterion at convergence: 11772.6
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.0439 -0.5361 -0.1174 0.3525 6.1959
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## cultivation.landrace.name trt0 0.000e+00 0.000e+00
## trt10 2.515e+02 1.586e+01 NaN
## trt15 1.940e+03 4.405e+01 NaN 1.00
## trt20 4.063e+03 6.375e+01 NaN 1.00
## cultivation.landrace.name.1 (Intercept) 6.406e+01 8.003e+00
## rep.run (Intercept) 1.306e+02 1.143e+01
## region (Intercept) 1.247e+02 1.117e+01
## cultivation (Intercept) 1.330e+03 3.647e+01
## trt10 6.085e+01 7.800e+00 0.70
## trt15 2.049e+02 1.431e+01 0.87 0.96
## trt20 3.370e+03 5.805e+01 0.86 0.97
## cultivation.1 (Intercept) 8.878e-10 2.980e-05
## rep (Intercept) 7.315e+01 8.553e+00
## Residual 4.286e+03 6.547e+01
##
##
##
##
## 1.00
##
##
##
##
##
##
## 1.00
##
##
##
## Number of obs: 1045, groups:
## cultivation:landrace.name, 23; rep:run, 8; region, 5; cultivation, 5; rep, 4
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 152.2022 19.2407 7.910
## trt10 0.0898 7.5787 0.012
## trt15 30.5996 13.0775 2.340
## trt20 138.5150 30.7778 4.500
##
## Correlation of Fixed Effects:
## (Intr) trt10 trt15
## trt10 0.156
## trt15 0.294 0.732
## trt20 0.603 0.681 0.803
## convergence code: 0
## unable to evaluate scaled gradient
## Model failed to converge: degenerate Hessian with 1 negative eigenvalues
anova(delay.b2) #trt not significant
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Error in calculation of the Satterthwaite's approximation. The output of lme4 package is returned
## anova from lme4 is returned
## some computational error has occurred in lmerTest
## Analysis of Variance Table
## Df Sum Sq Mean Sq F value
## trt 3 161928 53976 12.593
rand(delay.b2) #trt:cultivation:landrace significant at p < 0.001
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Analysis of Random effects Table:
## Chi.sq Chi.DF p.value
## cultivation 0.000 1 1.00
## trt:cultivation 13.471 10 0.20
## cultivation:landrace.name 0.486 1 0.49
## region 2.778 1 0.10 .
## trt:cultivation:landrace.name 51.531 10 1e-07 ***
## rep 0.000 1 1.00
## rep:run 3.766 1 0.05 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot.new()
plot(residuals(delay.b2))
hist(residuals(delay.b2))

plot(fitted(delay.b2), residuals(delay.b2))
qqnorm(resid(delay.b2)) #check normal distribution of residuals
qqline(resid(delay.b2)) #heavy tails
ranef<- ranef(delay.b2, condVar = T) #extract conditional means
## Warning in ranef.merMod(delay.b2, condVar = T): conditional variances not
## currently available via ranef when there are multiple terms per factor
ranef
## $`cultivation:landrace.name`
## trt0 trt10 trt15 trt20
## : 0 17.8644949 49.619842 71.806523
## :Tusta 0 -25.5423060 -70.945481 -102.667565
## Backyard:Chigole 0 -21.5320202 -59.806641 -86.548179
## Backyard:Chile Bolita 0 -10.4763256 -29.098702 -42.109699
## Backyard:Frutescens 0 -12.6426785 -35.115894 -50.817378
## Backyard:Guajillo 0 30.1796974 83.826149 121.307607
## Backyard:Mareno 0 16.8715369 46.861834 67.815318
## Backyard:Mirasol 0 -2.6801324 -7.444249 -10.772820
## Backyard:Paradito 0 3.7704301 10.472624 15.155283
## Backyard:Piquin 0 -5.6115636 -15.586497 -22.555738
## Backyard:Solterito 0 26.4667919 73.513303 106.383545
## Backyard:Tusta 0 -13.3489120 -37.077505 -53.656090
## Forest:Chile de Monte 0 8.2985407 23.049757 33.356070
## Milpa:Chile de Agua 0 -7.3990406 -20.551335 -29.740521
## Milpa:Costeno Rojo 0 -9.1593223 -25.440637 -36.815991
## Milpa:Dulce 0 -7.3053823 -20.291193 -29.364060
## Milpa:Payaso 0 -3.1623162 -8.783547 -12.710963
## Milpa:Taviche 0 -1.4494236 -4.025872 -5.825973
## Milpa:Tusta 0 16.5143196 45.869639 66.379479
## Plantation:Chile de Agua 0 -0.8008106 -2.224306 -3.218867
## Plantation:Costeno Amarillo 0 -6.6353650 -18.430175 -26.670919
## Plantation:Costeno Rojo 0 -2.4047962 -6.679484 -9.666103
## Plantation:Guina Dahni 0 10.1845837 28.288370 40.937040
## (Intercept)
## : 3.64909946
## :Tusta -1.02531167
## Backyard:Chigole -4.66497588
## Backyard:Chile Bolita -7.96111519
## Backyard:Frutescens 0.20498904
## Backyard:Guajillo 2.89869475
## Backyard:Mareno -2.18751617
## Backyard:Mirasol 4.02534148
## Backyard:Paradito 2.51393251
## Backyard:Piquin 2.16458589
## Backyard:Solterito 1.53366261
## Backyard:Tusta -1.95059905
## Forest:Chile de Monte 2.26463026
## Milpa:Chile de Agua 0.01031879
## Milpa:Costeno Rojo -0.27814170
## Milpa:Dulce -2.82960973
## Milpa:Payaso -2.68706694
## Milpa:Taviche 0.29083123
## Milpa:Tusta 5.37612917
## Plantation:Chile de Agua 0.99411371
## Plantation:Costeno Amarillo -1.70804001
## Plantation:Costeno Rojo 2.05234535
## Plantation:Guina Dahni -2.68629791
##
## $`rep:run`
## (Intercept)
## 1:1 13.701983
## 1:2 1.200713
## 2:3 5.446777
## 2:4 -8.316762
## 3:5 -5.305218
## 3:6 -4.127765
## 4:7 9.451496
## 4:8 -12.051225
##
## $region
## (Intercept)
## central valleys 0.5027801
## ecoast 12.5922233
## sierra madre -1.9965520
## wcoast -10.4837447
## yucatan -0.6147067
##
## $cultivation
## (Intercept) trt10 trt15 trt20 (Intercept)
## 33.259289 3.064175 8.967764 35.21140 3.636481e-11
## Backyard 4.057958 7.299000 9.787366 41.21696 -4.744161e-11
## Forest 33.230750 4.029348 10.174964 40.34095 3.138700e-11
## Milpa -34.349568 -7.436722 -14.624556 -59.14202 -1.629053e-12
## Plantation -36.198430 -6.955801 -14.305539 -57.62728 -1.868114e-11
##
## $rep
## (Intercept)
## 1 8.346124
## 2 -1.607310
## 3 -5.282859
## 4 -1.455955
dotplot(ranef)
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## $`cultivation:landrace.name`
##
## $`rep:run`
##
## $region
##
## $cultivation
##
## $rep
which(residuals(delay.b2) > 300)
## 910 3228 7153 8270 9039
## 88 313 692 799 875
which(residuals(delay.b2) < -200)
## named integer(0)
#####
#RATE OF GERMINATION
#####
summary(sum$rategerm)
## V1
## Min. :0.000000
## 1st Qu.:0.003347
## Median :0.004836
## Mean :0.004873
## 3rd Qu.:0.006378
## Max. :0.016667
rategerm.a1 <- lmer(t50 ~ trt + (1|region) + (trt|region) + (1|region:landrace.name) + (0 + trt|region:landrace.name)
+ (1|rep) + (1|rep:run), data = sum, REML = T, na.action = na.omit)
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
summary(rategerm.a1)
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Error in calculation of the Satterthwaite's approximation. The output of lme4 package is returned
## summary from lme4 is returned
## some computational error has occurred in lmerTest
## Linear mixed model fit by REML ['lmerMod']
## Formula:
## t50 ~ trt + (1 | region) + (trt | region) + (1 | region:landrace.name) +
## (0 + trt | region:landrace.name) + (1 | rep) + (1 | rep:run)
## Data: sum
##
## REML criterion at convergence: 10229.5
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.4260 -0.5751 -0.1426 0.4626 6.0679
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## region.landrace.name trt0 2266.813 47.611
## trt10 4768.326 69.053 0.99
## trt15 5111.458 71.494 0.99 1.00
## trt20 11056.107 105.148 0.91 0.95 0.96
## region.landrace.name.1 (Intercept) 0.000 0.000
## rep.run (Intercept) 269.126 16.405
## region (Intercept) 485.299 22.030
## trt10 198.931 14.104 1.00
## trt15 435.846 20.877 0.86 0.86
## trt20 1293.479 35.965 0.85 0.85 1.00
## region.1 (Intercept) 0.000 0.000
## rep (Intercept) 2.748 1.658
## Residual 3551.180 59.592
## Number of obs: 921, groups:
## region:landrace.name, 22; rep:run, 8; region, 5; rep, 4
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 199.093 17.002 11.710
## trt10 3.036 10.222 0.297
## trt15 28.264 13.126 2.153
## trt20 104.921 24.636 4.259
##
## Correlation of Fixed Effects:
## (Intr) trt10 trt15
## trt10 0.672
## trt15 0.635 0.801
## trt20 0.640 0.774 0.886
## convergence code: 0
## unable to evaluate scaled gradient
## Model failed to converge: degenerate Hessian with 1 negative eigenvalues
anova(rategerm.a1) #trt significant (p < 0.0099)
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Error in calculation of the Satterthwaite's approximation. The output of lme4 package is returned
## anova from lme4 is returned
## some computational error has occurred in lmerTest
## Analysis of Variance Table
## Df Sum Sq Mean Sq F value
## trt 3 155156 51719 14.564
anova(rategerm.a1, ddf = "Kenward-Roger") #trt not significant, p =.5891
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Analysis of Variance Table of type III with Kenward-Roger
## approximation for degrees of freedom
## Sum Sq Mean Sq NumDF DenDF F.value Pr(>F)
## trt 19387 6462.4 3 0.63965 1.8198 0.567
rand(rategerm.a1) #run nested in rep highly significant
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 2 negative
## eigenvalues
## Analysis of Random effects Table:
## Chi.sq Chi.DF p.value
## region 0.00e+00 1 1.0
## trt:region 3.26e+00 10 1.0
## region:landrace.name 2.11e+00 1 0.1
## trt:region:landrace.name 4.27e+01 10 6e-06 ***
## rep 2.86e-04 1 1.0
## rep:run 2.57e+01 1 4e-07 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
par(mfrow=c(2,2))

plot(residuals(rategerm.a1))
hist(residuals(rategerm.a1))
plot(fitted(rategerm.a1), residuals(rategerm.a1))
qqnorm(resid(rategerm.a1)) #check normal distribution of residuals
qqline(resid(rategerm.a1)) #heavy tails present

ranef<- ranef(rategerm.a1, condVar = T); ranef #extract conditional means
## Warning in ranef.merMod(rategerm.a1, condVar = T): conditional variances
## not currently available via ranef when there are multiple terms per factor
## $`region:landrace.name`
## trt0 trt10 trt15
## central valleys:Chile de Agua -27.465829 -38.158656 -38.881298
## central valleys:Taviche -18.002443 -29.404847 -31.375068
## central valleys:Tusta -1.108670 2.028048 3.214283
## ecoast: 67.105141 96.752821 99.718265
## ecoast:Chigole -12.233697 -25.186570 -28.298070
## ecoast:Chile Bolita 4.717743 11.781446 13.685939
## ecoast:Chile de Monte 68.526966 101.498350 105.444745
## ecoast:Costeno Rojo -36.534107 -69.530010 -76.885368
## ecoast:Frutescens 12.680515 23.580253 25.944944
## ecoast:Guajillo 73.578587 110.699513 115.522325
## ecoast:Guina Dahni -73.513426 -103.231705 -105.540041
## ecoast:Mareno -25.684752 -36.414694 -37.339294
## ecoast:Mirasol 38.920775 53.918355 54.889652
## ecoast:Payaso -61.488408 -85.729100 -87.449898
## ecoast:Solterito 31.855281 51.742720 55.130555
## ecoast:Tusta -2.713495 -4.875536 -5.323520
## sierra madre:Tusta 19.387956 22.191520 21.085635
## wcoast:Costeno Amarillo -48.730323 -70.096841 -72.194766
## wcoast:Costeno Rojo -37.640448 -54.439745 -56.160811
## wcoast:Piquin 51.033618 68.645857 69.220220
## yucatan:Dulce -59.810088 -82.624802 -84.038295
## yucatan:Paradito 37.119105 56.853624 59.629866
## trt20 (Intercept)
## central valleys:Chile de Agua -47.870735 0
## central valleys:Taviche -54.534132 0
## central valleys:Tusta 16.874422 0
## ecoast: 135.525196 0
## ecoast:Chigole -64.487990 0
## ecoast:Chile Bolita 35.771392 0
## ecoast:Chile de Monte 152.603351 0
## ecoast:Costeno Rojo -162.616410 0
## ecoast:Frutescens 53.529009 0
## ecoast:Guajillo 172.912656 0
## ecoast:Guina Dahni -133.917515 0
## ecoast:Mareno -48.616592 0
## ecoast:Mirasol 67.019836 0
## ecoast:Payaso -108.763165 0
## ecoast:Solterito 94.974395 0
## ecoast:Tusta -10.556625 0
## sierra madre:Tusta 8.786347 0
## wcoast:Costeno Amarillo -97.556450 0
## wcoast:Costeno Rojo -76.911236 0
## wcoast:Piquin 77.058134 0
## yucatan:Dulce -101.766125 0
## yucatan:Paradito 92.542237 0
##
## $`rep:run`
## (Intercept)
## 1:1 17.851671
## 1:2 1.546235
## 2:3 -2.322509
## 2:4 -16.570490
## 3:5 -9.686758
## 3:6 -8.783013
## 4:7 27.805062
## 4:8 -9.840198
##
## $region
## (Intercept) trt10 trt15 trt20 (Intercept)
## central valleys -11.6176861 -7.4381660 -1.6855496 -1.7859551 0
## ecoast 24.7371807 15.8378575 22.5943871 38.4442223 0
## sierra madre 0.7065658 0.4523752 -1.2981185 -2.4443331 0
## wcoast -10.8857354 -6.9695382 -19.1369454 -33.6759354 0
## yucatan -2.9403249 -1.8825285 -0.4737736 -0.5379987 0
##
## $rep
## (Intercept)
## 1 0.1980476
## 2 -0.1928926
## 3 -0.1885716
## 4 0.1834166
dotplot(ranef)
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## $`region:landrace.name`

##
## $`rep:run`

##
## $region

##
## $rep

#which(residuals(rategerm.a1) > 200)
#which(residuals(rategerm.a1) < -200)
#sum[c("2768","3537","8270","8330","8760","8900","8989","9068","9828"),]
rategerm.a2 <- lmer(t50 ~ trt + (1|region) + (trt|region) + (1|region:landrace.name) + (1|cultivation) + (0 + trt|region:landrace.name)
+ (1|rep) + (1|rep:run), data = sum, REML = T, na.action = na.omit)
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
summary(rategerm.a2)
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Error in calculation of the Satterthwaite's approximation. The output of lme4 package is returned
## summary from lme4 is returned
## some computational error has occurred in lmerTest
## Linear mixed model fit by REML ['lmerMod']
## Formula:
## t50 ~ trt + (1 | region) + (trt | region) + (1 | region:landrace.name) +
## (1 | cultivation) + (0 + trt | region:landrace.name) + (1 |
## rep) + (1 | rep:run)
## Data: sum
##
## REML criterion at convergence: 10224.3
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.4959 -0.5882 -0.1192 0.4517 6.0633
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## region.landrace.name trt0 1479.974 38.470
## trt10 3899.123 62.443 1.00
## trt15 4036.128 63.531 0.99 1.00
## trt20 9841.585 99.205 0.91 0.94 0.96
## region.landrace.name.1 (Intercept) 0.000 0.000
## rep.run (Intercept) 271.296 16.471
## cultivation (Intercept) 721.433 26.860
## region (Intercept) 391.006 19.774
## trt10 127.492 11.291 1.00
## trt15 434.357 20.841 1.00 1.00
## trt20 1251.994 35.384 1.00 1.00 1.00
## region.1 (Intercept) 0.000 0.000
## rep (Intercept) 4.278 2.068
## Residual 3530.325 59.417
## Number of obs: 921, groups:
## region:landrace.name, 22; rep:run, 8; cultivation, 5; region, 5; rep, 4
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 205.979 19.958 10.320
## trt10 4.313 9.458 0.456
## trt15 28.111 13.108 2.145
## trt20 106.385 24.525 4.338
##
## Correlation of Fixed Effects:
## (Intr) trt10 trt15
## trt10 0.454
## trt15 0.506 0.840
## trt20 0.512 0.808 0.882
## convergence code: 0
## unable to evaluate scaled gradient
## Model failed to converge: degenerate Hessian with 1 negative eigenvalues
anova(rategerm.a2) #trt significant (p < 0.0099)
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Analysis of Variance Table of type III with Satterthwaite
## approximation for degrees of freedom
## Sum Sq Mean Sq NumDF DenDF F.value Pr(>F)
## trt 151482 50494 3 4.4233 14.312 0.009938 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(rategerm.a2, ddf = "Kenward-Roger") #trt not significant, p =.5891
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Analysis of Variance Table of type III with Kenward-Roger
## approximation for degrees of freedom
## Sum Sq Mean Sq NumDF DenDF F.value Pr(>F)
## trt 17975 5991.6 3 0.59887 1.6983 0.5891
rand(rategerm.a2) #run nested in rep highly significant
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Analysis of Random effects Table:
## Chi.sq Chi.DF p.value
## region 0.00 1 1.00
## trt:region 3.09 10 0.98
## region:landrace.name 0.00 1 1.00
## cultivation 5.20 1 0.02 *
## trt:region:landrace.name 44.06 10 3e-06 ***
## rep 0.00 1 1.00
## rep:run 18.31 1 2e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
par(mfrow=c(2,2))
plot(residuals(rategerm.a2))
hist(residuals(rategerm.a2))
plot(fitted(rategerm.a2), residuals(rategerm.a2))
qqnorm(resid(rategerm.a2)) #check normal distribution of residuals
qqline(resid(rategerm.a2)) #heavy tails present

ranef<- ranef(rategerm.a2, condVar = T); ranef #extract conditional means
## Warning in ranef.merMod(rategerm.a2, condVar = T): conditional variances
## not currently available via ranef when there are multiple terms per factor
## $`region:landrace.name`
## trt0 trt10 trt15 trt20
## central valleys:Chile de Agua -32.684660 -50.457156 -48.930669 -57.362991
## central valleys:Taviche -15.352164 -26.730095 -28.554211 -51.118502
## central valleys:Tusta -7.393158 -8.861446 -6.376162 7.383467
## ecoast: 39.730571 64.597162 65.477908 95.760550
## ecoast:Chigole -12.408228 -24.885121 -29.110808 -67.490984
## ecoast:Chile Bolita 5.052663 10.864129 13.197744 33.313342
## ecoast:Chile de Monte 53.794561 88.534377 90.624933 138.201729
## ecoast:Costeno Rojo -30.405903 -59.822456 -69.206543 -156.148471
## ecoast:Frutescens 11.998538 22.484359 25.246238 52.664048
## ecoast:Guajillo 68.382266 112.809026 115.689897 177.803881
## ecoast:Guina Dahni -60.694210 -96.358327 -95.755489 -127.753018
## ecoast:Mareno -22.336706 -35.808947 -35.878194 -49.785114
## ecoast:Mirasol 33.775812 53.707996 53.444146 71.774858
## ecoast:Payaso -38.554520 -61.283618 -60.963020 -81.745064
## ecoast:Solterito 29.283369 50.999616 54.490334 97.613308
## ecoast:Tusta 3.926099 5.355209 4.580001 1.259977
## sierra madre:Tusta -6.663070 -12.621892 -14.269513 -30.329021
## wcoast:Costeno Amarillo -36.195374 -58.368234 -58.767131 -83.401352
## wcoast:Costeno Rojo -21.777211 -36.443931 -37.796164 -60.760224
## wcoast:Piquin 49.083700 75.407180 72.807779 83.223174
## yucatan:Dulce -40.846281 -64.080302 -63.031051 -79.853442
## yucatan:Paradito 30.283907 50.962470 53.079976 86.749851
## (Intercept)
## central valleys:Chile de Agua 0
## central valleys:Taviche 0
## central valleys:Tusta 0
## ecoast: 0
## ecoast:Chigole 0
## ecoast:Chile Bolita 0
## ecoast:Chile de Monte 0
## ecoast:Costeno Rojo 0
## ecoast:Frutescens 0
## ecoast:Guajillo 0
## ecoast:Guina Dahni 0
## ecoast:Mareno 0
## ecoast:Mirasol 0
## ecoast:Payaso 0
## ecoast:Solterito 0
## ecoast:Tusta 0
## sierra madre:Tusta 0
## wcoast:Costeno Amarillo 0
## wcoast:Costeno Rojo 0
## wcoast:Piquin 0
## yucatan:Dulce 0
## yucatan:Paradito 0
##
## $`rep:run`
## (Intercept)
## 1:1 18.3078298
## 1:2 0.9228548
## 2:3 -2.3443798
## 2:4 -16.7382430
## 3:5 -10.4376656
## 3:6 -7.8459073
## 4:7 27.7021788
## 4:8 -9.5666677
##
## $cultivation
## (Intercept)
## 29.352969
## Backyard -2.142579
## Forest 11.320961
## Milpa -27.547490
## Plantation -10.983861
##
## $region
## (Intercept) trt10 trt15 trt20 (Intercept)
## central valleys 0.6480805 0.3700652 0.848937 1.473876 0
## ecoast 21.4261514 12.2347036 22.524803 38.220343 0
## sierra madre -1.1262642 -0.6431164 -1.194063 -2.028101 0
## wcoast -19.2408063 -10.9868336 -20.427599 -34.701661 0
## yucatan -1.7071615 -0.9748188 -1.752078 -2.964457 0
##
## $rep
## (Intercept)
## 1 0.3032442
## 2 -0.3009094
## 3 -0.2883094
## 4 0.2859747
dotplot(ranef)
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## $`region:landrace.name`

##
## $`rep:run`

##
## $cultivation

##
## $region

##
## $rep

#which(residuals(rategerm.a2) > 200)
#which(residuals(rategerm.a2) < -200)
#sum[c("2768","3537","8270","8330","8760","8900","8989","9068","9828"),]
rategerm.b1 <- lmer(t50 ~ trt + (1|cultivation) + (trt|cultivation) + (1|cultivation:landrace.name) + (1|region) +
(0+trt|cultivation:landrace.name)
+ (1|rep) + (1|rep:run), data = sum, REML = T, na.action = na.omit)
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
summary(rategerm.b1)
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Linear mixed model fit by REML t-tests use Satterthwaite approximations
## to degrees of freedom [lmerMod]
## Formula:
## t50 ~ trt + (1 | cultivation) + (trt | cultivation) + (1 | cultivation:landrace.name) +
## (1 | region) + (0 + trt | cultivation:landrace.name) + (1 |
## rep) + (1 | rep:run)
## Data: sum
##
## REML criterion at convergence: 10220.6
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.6705 -0.5606 -0.1370 0.4556 5.9302
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## cultivation.landrace.name trt0 7.062e+02 26.5749
## trt10 1.190e+03 34.4989 1.00
## trt15 2.068e+03 45.4749 0.97 0.98
## trt20 2.944e+03 54.2550 0.81 0.83 0.92
## cultivation.landrace.name.1 (Intercept) 0.000e+00 0.0000
## rep.run (Intercept) 2.728e+02 16.5164
## region (Intercept) 3.422e+02 18.4989
## cultivation (Intercept) 2.644e+03 51.4178
## trt10 6.754e+02 25.9882 0.87
## trt15 7.073e+02 26.5960 0.97 0.96
## trt20 2.893e+03 53.7911 0.89 1.00 0.97
## cultivation.1 (Intercept) 0.000e+00 0.0000
## rep (Intercept) 5.012e-02 0.2239
## Residual 3.559e+03 59.6532
## Number of obs: 921, groups:
## cultivation:landrace.name, 23; rep:run, 8; region, 5; cultivation, 5; rep, 4
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 207.702 26.894 4.258 7.723 0.00117 **
## trt10 8.620 13.464 3.196 0.640 0.56497
## trt15 37.954 14.167 3.054 2.679 0.07369 .
## trt20 119.320 27.607 2.974 4.322 0.02323 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) trt10 trt15
## trt10 0.658
## trt15 0.753 0.854
## trt20 0.695 0.895 0.881
anova(rategerm.b1, ddf = "Kenward-Roger") #trt highly significant (p < 0.0001)
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Analysis of Variance Table of type III with Kenward-Roger
## approximation for degrees of freedom
## Sum Sq Mean Sq NumDF DenDF F.value Pr(>F)
## trt 35315 11772 3 0.61712 3.308 0.4863
rand(rategerm.b1) #run in rep highly significant, trt:cultivation significant at p = 0.09
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Analysis of Random effects Table:
## Chi.sq Chi.DF p.value
## cultivation 1.42e-08 1 1.00
## trt:cultivation 1.24e+01 10 0.26
## cultivation:landrace.name 1.65e-08 1 1.00
## region 2.12e+01 1 4e-06 ***
## trt:cultivation:landrace.name 2.04e+01 10 0.03 *
## rep 1.50e-08 1 1.00
## rep:run 1.87e+01 1 2e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(residuals(rategerm.b1))
hist(residuals(rategerm.b1))
plot(fitted(rategerm.b1), residuals(rategerm.b1))
qqnorm(resid(rategerm.b1)) #check normal distribution of residuals
qqline(resid(rategerm.b1))

ranef<- ranef(rategerm.b1, condVar = T) #extract conditional means
## Warning in ranef.merMod(rategerm.b1, condVar = T): conditional variances
## not currently available via ranef when there are multiple terms per factor
ranef
## $`cultivation:landrace.name`
## trt0 trt10 trt15 trt20
## : 34.477090 44.969588 59.0902055 62.022543
## :Tusta -17.071766 -23.310523 -36.4127286 -52.021998
## Backyard:Chigole -30.444920 -41.250786 -62.7423215 -86.236428
## Backyard:Chile Bolita -14.305893 -17.533560 -16.7975030 -2.733105
## Backyard:Frutescens -3.313767 -3.439350 0.3744469 12.073766
## Backyard:Guajillo 48.486299 63.555742 85.2500789 93.628001
## Backyard:Mareno -36.972399 -47.880018 -61.0062187 -59.478789
## Backyard:Mirasol 16.803197 21.663904 27.0638263 25.058997
## Backyard:Paradito 8.567301 11.251917 15.2135659 16.991317
## Backyard:Piquin 11.033683 12.445209 5.5646179 -19.909723
## Backyard:Solterito 12.243032 17.104436 28.7688885 45.218474
## Backyard:Tusta -24.141898 -30.955972 -37.7214454 -32.540628
## Forest:Chile de Monte 16.676378 22.048767 30.6196257 36.071385
## Milpa:Chile de Agua -2.648137 -3.306901 -3.5296559 -1.758034
## Milpa:Costeno Rojo -17.241632 -23.212666 -34.5136672 -45.802813
## Milpa:Dulce -20.042724 -25.555400 -30.3263913 -24.065685
## Milpa:Payaso -13.793040 -17.196083 -18.1912504 -8.581140
## Milpa:Taviche 13.000338 16.565761 19.6002216 15.399956
## Milpa:Tusta 33.509787 44.265783 61.2576207 71.678210
## Plantation:Chile de Agua 13.104518 17.747254 26.9483146 36.946002
## Plantation:Costeno Amarillo -16.625239 -22.031970 -30.8741710 -36.998806
## Plantation:Costeno Rojo 7.812838 7.968740 -1.8440634 -31.329802
## Plantation:Guina Dahni -19.113046 -23.913872 -25.7919962 -13.631699
## (Intercept)
## : 0
## :Tusta 0
## Backyard:Chigole 0
## Backyard:Chile Bolita 0
## Backyard:Frutescens 0
## Backyard:Guajillo 0
## Backyard:Mareno 0
## Backyard:Mirasol 0
## Backyard:Paradito 0
## Backyard:Piquin 0
## Backyard:Solterito 0
## Backyard:Tusta 0
## Forest:Chile de Monte 0
## Milpa:Chile de Agua 0
## Milpa:Costeno Rojo 0
## Milpa:Dulce 0
## Milpa:Payaso 0
## Milpa:Taviche 0
## Milpa:Tusta 0
## Plantation:Chile de Agua 0
## Plantation:Costeno Amarillo 0
## Plantation:Costeno Rojo 0
## Plantation:Guina Dahni 0
##
## $`rep:run`
## (Intercept)
## 1:1 18.6561185
## 1:2 0.8462535
## 2:3 -2.1566200
## 2:4 -17.3220567
## 3:5 -10.5929563
## 3:6 -7.9010126
## 4:7 27.6819797
## 4:8 -9.2117062
##
## $region
## (Intercept)
## central valleys -9.760166
## ecoast 24.514924
## sierra madre -0.418689
## wcoast -9.646969
## yucatan -4.689100
##
## $cultivation
## (Intercept) trt10 trt15 trt20 (Intercept)
## 31.68958 3.424347 10.99794 8.760815 0
## Backyard 15.29118 18.882478 13.43313 37.942100 0
## Forest 54.03144 26.415105 28.45629 55.200116 0
## Milpa -48.16664 -22.988153 -25.10353 -48.113192 0
## Plantation -52.84555 -25.733777 -27.78383 -53.789839 0
##
## $rep
## (Intercept)
## 1 0.003582938
## 2 -0.003578585
## 3 -0.003397676
## 4 0.003393323
dotplot(ranef)
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## $`cultivation:landrace.name`

##
## $`rep:run`

##
## $region

##
## $cultivation

##
## $rep

#which(residuals(rategerm.b1) > 200)
#which(residuals(rategerm.b1) < -180)
rategerm.b2 <- lmer(t50 ~ trt + (1|cultivation) + (trt|cultivation) + (1|cultivation:landrace.name) + (1|region) +
(0+trt|cultivation:landrace.name)
+ (1|rep) + (1|rep:run), data = sum, REML = T, na.action = na.omit)
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
summary(rategerm.b2)
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Linear mixed model fit by REML t-tests use Satterthwaite approximations
## to degrees of freedom [lmerMod]
## Formula:
## t50 ~ trt + (1 | cultivation) + (trt | cultivation) + (1 | cultivation:landrace.name) +
## (1 | region) + (0 + trt | cultivation:landrace.name) + (1 |
## rep) + (1 | rep:run)
## Data: sum
##
## REML criterion at convergence: 10220.6
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.6705 -0.5606 -0.1370 0.4556 5.9302
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## cultivation.landrace.name trt0 7.062e+02 26.5749
## trt10 1.190e+03 34.4989 1.00
## trt15 2.068e+03 45.4749 0.97 0.98
## trt20 2.944e+03 54.2550 0.81 0.83 0.92
## cultivation.landrace.name.1 (Intercept) 0.000e+00 0.0000
## rep.run (Intercept) 2.728e+02 16.5164
## region (Intercept) 3.422e+02 18.4989
## cultivation (Intercept) 2.644e+03 51.4178
## trt10 6.754e+02 25.9882 0.87
## trt15 7.073e+02 26.5960 0.97 0.96
## trt20 2.893e+03 53.7911 0.89 1.00 0.97
## cultivation.1 (Intercept) 0.000e+00 0.0000
## rep (Intercept) 5.012e-02 0.2239
## Residual 3.559e+03 59.6532
## Number of obs: 921, groups:
## cultivation:landrace.name, 23; rep:run, 8; region, 5; cultivation, 5; rep, 4
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 207.702 26.894 4.258 7.723 0.00117 **
## trt10 8.620 13.464 3.196 0.640 0.56497
## trt15 37.954 14.167 3.054 2.679 0.07369 .
## trt20 119.320 27.607 2.974 4.322 0.02323 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) trt10 trt15
## trt10 0.658
## trt15 0.753 0.854
## trt20 0.695 0.895 0.881
anova(rategerm.b2, ddf = "Kenward-Roger") #trt highly significant (p < 0.0001)
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Analysis of Variance Table of type III with Kenward-Roger
## approximation for degrees of freedom
## Sum Sq Mean Sq NumDF DenDF F.value Pr(>F)
## trt 35315 11772 3 0.61712 3.308 0.4863
rand(rategerm.b2) #run in rep highly significant, trt:cultivation significant at p = 0.09
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Analysis of Random effects Table:
## Chi.sq Chi.DF p.value
## cultivation 1.42e-08 1 1.00
## trt:cultivation 1.24e+01 10 0.26
## cultivation:landrace.name 1.65e-08 1 1.00
## region 2.12e+01 1 4e-06 ***
## trt:cultivation:landrace.name 2.04e+01 10 0.03 *
## rep 1.50e-08 1 1.00
## rep:run 1.87e+01 1 2e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(residuals(rategerm.b2))
hist(residuals(rategerm.b2))
plot(fitted(rategerm.b2), residuals(rategerm.b2))
qqnorm(resid(rategerm.b2)) #check normal distribution of residuals
qqline(resid(rategerm.b2))

ranef<- ranef(rategerm.b2, condVar = T) #extract conditional means
## Warning in ranef.merMod(rategerm.b2, condVar = T): conditional variances
## not currently available via ranef when there are multiple terms per factor
ranef
## $`cultivation:landrace.name`
## trt0 trt10 trt15 trt20
## : 34.477090 44.969588 59.0902055 62.022543
## :Tusta -17.071766 -23.310523 -36.4127286 -52.021998
## Backyard:Chigole -30.444920 -41.250786 -62.7423215 -86.236428
## Backyard:Chile Bolita -14.305893 -17.533560 -16.7975030 -2.733105
## Backyard:Frutescens -3.313767 -3.439350 0.3744469 12.073766
## Backyard:Guajillo 48.486299 63.555742 85.2500789 93.628001
## Backyard:Mareno -36.972399 -47.880018 -61.0062187 -59.478789
## Backyard:Mirasol 16.803197 21.663904 27.0638263 25.058997
## Backyard:Paradito 8.567301 11.251917 15.2135659 16.991317
## Backyard:Piquin 11.033683 12.445209 5.5646179 -19.909723
## Backyard:Solterito 12.243032 17.104436 28.7688885 45.218474
## Backyard:Tusta -24.141898 -30.955972 -37.7214454 -32.540628
## Forest:Chile de Monte 16.676378 22.048767 30.6196257 36.071385
## Milpa:Chile de Agua -2.648137 -3.306901 -3.5296559 -1.758034
## Milpa:Costeno Rojo -17.241632 -23.212666 -34.5136672 -45.802813
## Milpa:Dulce -20.042724 -25.555400 -30.3263913 -24.065685
## Milpa:Payaso -13.793040 -17.196083 -18.1912504 -8.581140
## Milpa:Taviche 13.000338 16.565761 19.6002216 15.399956
## Milpa:Tusta 33.509787 44.265783 61.2576207 71.678210
## Plantation:Chile de Agua 13.104518 17.747254 26.9483146 36.946002
## Plantation:Costeno Amarillo -16.625239 -22.031970 -30.8741710 -36.998806
## Plantation:Costeno Rojo 7.812838 7.968740 -1.8440634 -31.329802
## Plantation:Guina Dahni -19.113046 -23.913872 -25.7919962 -13.631699
## (Intercept)
## : 0
## :Tusta 0
## Backyard:Chigole 0
## Backyard:Chile Bolita 0
## Backyard:Frutescens 0
## Backyard:Guajillo 0
## Backyard:Mareno 0
## Backyard:Mirasol 0
## Backyard:Paradito 0
## Backyard:Piquin 0
## Backyard:Solterito 0
## Backyard:Tusta 0
## Forest:Chile de Monte 0
## Milpa:Chile de Agua 0
## Milpa:Costeno Rojo 0
## Milpa:Dulce 0
## Milpa:Payaso 0
## Milpa:Taviche 0
## Milpa:Tusta 0
## Plantation:Chile de Agua 0
## Plantation:Costeno Amarillo 0
## Plantation:Costeno Rojo 0
## Plantation:Guina Dahni 0
##
## $`rep:run`
## (Intercept)
## 1:1 18.6561185
## 1:2 0.8462535
## 2:3 -2.1566200
## 2:4 -17.3220567
## 3:5 -10.5929563
## 3:6 -7.9010126
## 4:7 27.6819797
## 4:8 -9.2117062
##
## $region
## (Intercept)
## central valleys -9.760166
## ecoast 24.514924
## sierra madre -0.418689
## wcoast -9.646969
## yucatan -4.689100
##
## $cultivation
## (Intercept) trt10 trt15 trt20 (Intercept)
## 31.68958 3.424347 10.99794 8.760815 0
## Backyard 15.29118 18.882478 13.43313 37.942100 0
## Forest 54.03144 26.415105 28.45629 55.200116 0
## Milpa -48.16664 -22.988153 -25.10353 -48.113192 0
## Plantation -52.84555 -25.733777 -27.78383 -53.789839 0
##
## $rep
## (Intercept)
## 1 0.003582938
## 2 -0.003578585
## 3 -0.003397676
## 4 0.003393323
dotplot(ranef)
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## $`cultivation:landrace.name`

##
## $`rep:run`

##
## $region

##
## $cultivation

##
## $rep

#which(residuals(rategerm.b) > 200)
#which(residuals(rategerm.b) < -180)
#####
#UNIFORMITY
#####
summary(sum$uniform)
## V1
## Min. : 0.00
## 1st Qu.: 0.00
## Median : 48.40
## Mean : 66.07
## 3rd Qu.: 96.40
## Max. :412.50
## NA's :208
uniform.a1 <- lmer(uniform ~ trt + (1|region) + (trt|region) + (1|region:landrace.name) +(1|cultivation) + (trt|region:landrace.name)
+ (1|rep) + (1|rep:run), data = sum, REML = T)
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 2 negative
## eigenvalues
summary(uniform.a1)
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Error in calculation of the Satterthwaite's approximation. The output of lme4 package is returned
## summary from lme4 is returned
## some computational error has occurred in lmerTest
## Linear mixed model fit by REML ['lmerMod']
## Formula:
## uniform ~ trt + (1 | region) + (trt | region) + (1 | region:landrace.name) +
## (1 | cultivation) + (trt | region:landrace.name) + (1 | rep) +
## (1 | rep:run)
## Data: sum
##
## REML criterion at convergence: 9126.3
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.2541 -0.6182 -0.1510 0.3559 6.3114
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## region.landrace.name (Intercept) 0.000e+00 0.000e+00
## trt10 2.525e+02 1.589e+01 NaN
## trt15 1.022e+03 3.197e+01 NaN 0.95
## trt20 2.669e+03 5.166e+01 NaN 0.69 0.88
## region.landrace.name.1 (Intercept) 5.642e+02 2.375e+01
## rep.run (Intercept) 1.076e+02 1.038e+01
## cultivation (Intercept) 1.258e-11 3.547e-06
## region (Intercept) 0.000e+00 0.000e+00
## trt10 4.440e+01 6.663e+00 NaN
## trt15 8.837e+01 9.401e+00 NaN 1.00
## trt20 1.802e-03 4.245e-02 NaN -1.00 -1.00
## region.1 (Intercept) 2.287e+01 4.782e+00
## rep (Intercept) 4.498e+01 6.707e+00
## Residual 2.962e+03 5.443e+01
## Number of obs: 837, groups:
## region:landrace.name, 22; rep:run, 8; cultivation, 5; region, 5; rep, 4
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 62.816 8.666 7.248
## trt10 11.006 7.216 1.525
## trt15 17.335 10.722 1.617
## trt20 33.858 15.239 2.222
##
## Correlation of Fixed Effects:
## (Intr) trt10 trt15
## trt10 -0.221
## trt15 -0.169 0.769
## trt20 -0.119 0.411 0.625
## convergence code: 0
## unable to evaluate scaled gradient
## Model failed to converge: degenerate Hessian with 2 negative eigenvalues
anova(uniform.a1) #error in calculation
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 2 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Error in calculation of the Satterthwaite's approximation. The output of lme4 package is returned
## anova from lme4 is returned
## some computational error has occurred in lmerTest
## Analysis of Variance Table
## Df Sum Sq Mean Sq F value
## trt 3 16184 5394.6 1.8211
anova(uniform.a1, ddf = "Kenward-Roger") #trt not significant
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 2 negative
## eigenvalues
## Analysis of Variance Table of type III with Kenward-Roger
## approximation for degrees of freedom
## Sum Sq Mean Sq NumDF DenDF F.value Pr(>F)
## trt 714.63 238.21 3 0.27738 0.080416 0.957
rand(uniform.a1) #run within rep significant at p =.006, trt:region:landrace significant at p = 0.005
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 2 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 2 negative
## eigenvalues
## Analysis of Random effects Table:
## Chi.sq Chi.DF p.value
## region 0.0327 1 0.856
## trt:region 0.0000 10 1.000
## region:landrace.name 7.0401 1 0.008 **
## cultivation 0.0000 1 1.000
## trt:region:landrace.name 18.1232 10 0.053 .
## rep 0.0000 1 1.000
## rep:run 7.2256 1 0.007 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(residuals(uniform.a1)) #more positive than negative residuals
hist(residuals(uniform.a1))
plot(fitted(uniform.a1), residuals(uniform.a1))
qqnorm(resid(uniform.a1)) #check normal distribution of residuals
qqline(resid(uniform.a1)) #indicates right skew

ranef<- ranef(uniform.a1, condVar = T) #extract conditional means
## Warning in ranef.merMod(uniform.a1, condVar = T): conditional variances not
## currently available via ranef when there are multiple terms per factor
ranef
## $`region:landrace.name`
## (Intercept) trt10 trt15
## central valleys:Chile de Agua 0 -15.172775 -28.094530
## central valleys:Taviche 0 -6.277932 -18.013903
## central valleys:Tusta 0 -1.117300 6.165837
## ecoast: 0 7.090408 15.901601
## ecoast:Chigole 0 -6.743857 -25.314001
## ecoast:Chile Bolita 0 7.487687 10.215727
## ecoast:Chile de Monte 0 8.788923 18.140817
## ecoast:Costeno Rojo 0 -2.370880 -9.869176
## ecoast:Frutescens 0 9.520138 24.728601
## ecoast:Guajillo 0 -4.766380 -9.121079
## ecoast:Guina Dahni 0 -16.773911 -32.092333
## ecoast:Mareno 0 1.880257 2.410056
## ecoast:Mirasol 0 -1.657094 -3.201114
## ecoast:Payaso 0 -8.447751 -15.699533
## ecoast:Solterito 0 7.945607 16.213273
## ecoast:Tusta 0 16.060846 39.429294
## sierra madre:Tusta 0 5.016971 17.525489
## wcoast:Costeno Amarillo 0 -15.748636 -34.600293
## wcoast:Costeno Rojo 0 -13.965105 -27.927730
## wcoast:Piquin 0 18.520431 27.704806
## yucatan:Dulce 0 -10.583702 -24.904490
## yucatan:Paradito 0 21.314056 50.402682
## trt20 (Intercept)
## central valleys:Chile de Agua -30.2384364 3.051212
## central valleys:Taviche -36.8374161 10.259226
## central valleys:Tusta 29.1244024 -18.661214
## ecoast: 24.6870479 24.266598
## ecoast:Chigole -62.2743850 38.386529
## ecoast:Chile Bolita 1.0308533 20.963845
## ecoast:Chile de Monte 24.6234283 6.113152
## ecoast:Costeno Rojo -25.5853078 -8.476734
## ecoast:Frutescens 46.0069948 -1.480493
## ecoast:Guajillo -10.6239729 7.304466
## ecoast:Guina Dahni -37.3625281 -37.463496
## ecoast:Mareno -0.3321997 -7.951664
## ecoast:Mirasol -3.8079753 16.950053
## ecoast:Payaso -17.0541393 -23.648509
## ecoast:Solterito 21.5492144 26.867941
## ecoast:Tusta 68.9015719 -2.979411
## sierra madre:Tusta 41.3541489 -9.114573
## wcoast:Costeno Amarillo -52.0952997 -17.331256
## wcoast:Costeno Rojo -35.7101452 -23.255759
## wcoast:Piquin 11.8267861 12.011582
## yucatan:Dulce -41.2985803 -24.875335
## yucatan:Paradito 84.1159376 9.063839
##
## $`rep:run`
## (Intercept)
## 1:1 7.5999160
## 1:2 -7.4123840
## 2:3 -11.3527878
## 2:4 -0.5811445
## 3:5 3.6813092
## 3:6 -4.4962307
## 4:7 14.0602903
## 4:8 -1.4989684
##
## $cultivation
## (Intercept)
## 3.378235e-13
## Backyard 2.244461e-12
## Forest 1.362964e-13
## Milpa -1.922691e-12
## Plantation -7.958900e-13
##
## $region
## (Intercept) trt10 trt15 trt20 (Intercept)
## central valleys 0 -5.0896632 -7.1806026 0.032427861 -0.2168417
## ecoast 0 3.9128192 5.5202866 -0.024929813 2.3850057
## sierra madre 0 -1.2910816 -1.8214847 0.008225891 -0.3693707
## wcoast 0 1.7690271 2.4957801 -0.011271034 -1.1580278
## yucatan 0 0.6988985 0.9860206 -0.004452904 -0.6407655
##
## $rep
## (Intercept)
## 1 0.07836021
## 2 -4.98659311
## 3 -0.34051493
## 4 5.24874783
dotplot(ranef)
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## $`region:landrace.name`

##
## $`rep:run`

##
## $cultivation

##
## $region

##
## $rep

which(residuals(uniform.a1) > 200)
## 830 2419 2608 6247 7770 8070 8610 9388
## 61 179 194 484 618 637 675 727
uniform.a2 <- lmer(uniform ~ trt + (1|region) + (trt|region) + (1|region:landrace.name) +(1|cultivation) + (trt|region:landrace.name)
+ (1|rep) + (1|rep:run), data = sum, REML = T)
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 2 negative
## eigenvalues
summary(uniform.a2)
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Error in calculation of the Satterthwaite's approximation. The output of lme4 package is returned
## summary from lme4 is returned
## some computational error has occurred in lmerTest
## Linear mixed model fit by REML ['lmerMod']
## Formula:
## uniform ~ trt + (1 | region) + (trt | region) + (1 | region:landrace.name) +
## (1 | cultivation) + (trt | region:landrace.name) + (1 | rep) +
## (1 | rep:run)
## Data: sum
##
## REML criterion at convergence: 9126.3
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.2541 -0.6182 -0.1510 0.3559 6.3114
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## region.landrace.name (Intercept) 0.000e+00 0.000e+00
## trt10 2.525e+02 1.589e+01 NaN
## trt15 1.022e+03 3.197e+01 NaN 0.95
## trt20 2.669e+03 5.166e+01 NaN 0.69 0.88
## region.landrace.name.1 (Intercept) 5.642e+02 2.375e+01
## rep.run (Intercept) 1.076e+02 1.038e+01
## cultivation (Intercept) 1.258e-11 3.547e-06
## region (Intercept) 0.000e+00 0.000e+00
## trt10 4.440e+01 6.663e+00 NaN
## trt15 8.837e+01 9.401e+00 NaN 1.00
## trt20 1.802e-03 4.245e-02 NaN -1.00 -1.00
## region.1 (Intercept) 2.287e+01 4.782e+00
## rep (Intercept) 4.498e+01 6.707e+00
## Residual 2.962e+03 5.443e+01
## Number of obs: 837, groups:
## region:landrace.name, 22; rep:run, 8; cultivation, 5; region, 5; rep, 4
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 62.816 8.666 7.248
## trt10 11.006 7.216 1.525
## trt15 17.335 10.722 1.617
## trt20 33.858 15.239 2.222
##
## Correlation of Fixed Effects:
## (Intr) trt10 trt15
## trt10 -0.221
## trt15 -0.169 0.769
## trt20 -0.119 0.411 0.625
## convergence code: 0
## unable to evaluate scaled gradient
## Model failed to converge: degenerate Hessian with 2 negative eigenvalues
anova(uniform.a2) #error in calculation
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 2 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Error in calculation of the Satterthwaite's approximation. The output of lme4 package is returned
## anova from lme4 is returned
## some computational error has occurred in lmerTest
## Analysis of Variance Table
## Df Sum Sq Mean Sq F value
## trt 3 16184 5394.6 1.8211
anova(uniform.a2, ddf = "Kenward-Roger") #trt not significant
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 2 negative
## eigenvalues
## Analysis of Variance Table of type III with Kenward-Roger
## approximation for degrees of freedom
## Sum Sq Mean Sq NumDF DenDF F.value Pr(>F)
## trt 714.63 238.21 3 0.27738 0.080416 0.957
rand(uniform.a2) #run within rep significant at p =.006, trt:region:landrace significant at p = 0.005
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 2 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 2 negative
## eigenvalues
## Analysis of Random effects Table:
## Chi.sq Chi.DF p.value
## region 0.0327 1 0.856
## trt:region 0.0000 10 1.000
## region:landrace.name 7.0401 1 0.008 **
## cultivation 0.0000 1 1.000
## trt:region:landrace.name 18.1232 10 0.053 .
## rep 0.0000 1 1.000
## rep:run 7.2256 1 0.007 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(residuals(uniform.a2)) #more positive than negative residuals
hist(residuals(uniform.a2))
plot(fitted(uniform.a2), residuals(uniform.a2))
qqnorm(resid(uniform.a2)) #check normal distribution of residuals
qqline(resid(uniform.a2)) #indicates right skew

ranef<- ranef(uniform.a2, condVar = T) #extract conditional means
## Warning in ranef.merMod(uniform.a2, condVar = T): conditional variances not
## currently available via ranef when there are multiple terms per factor
ranef
## $`region:landrace.name`
## (Intercept) trt10 trt15
## central valleys:Chile de Agua 0 -15.172775 -28.094530
## central valleys:Taviche 0 -6.277932 -18.013903
## central valleys:Tusta 0 -1.117300 6.165837
## ecoast: 0 7.090408 15.901601
## ecoast:Chigole 0 -6.743857 -25.314001
## ecoast:Chile Bolita 0 7.487687 10.215727
## ecoast:Chile de Monte 0 8.788923 18.140817
## ecoast:Costeno Rojo 0 -2.370880 -9.869176
## ecoast:Frutescens 0 9.520138 24.728601
## ecoast:Guajillo 0 -4.766380 -9.121079
## ecoast:Guina Dahni 0 -16.773911 -32.092333
## ecoast:Mareno 0 1.880257 2.410056
## ecoast:Mirasol 0 -1.657094 -3.201114
## ecoast:Payaso 0 -8.447751 -15.699533
## ecoast:Solterito 0 7.945607 16.213273
## ecoast:Tusta 0 16.060846 39.429294
## sierra madre:Tusta 0 5.016971 17.525489
## wcoast:Costeno Amarillo 0 -15.748636 -34.600293
## wcoast:Costeno Rojo 0 -13.965105 -27.927730
## wcoast:Piquin 0 18.520431 27.704806
## yucatan:Dulce 0 -10.583702 -24.904490
## yucatan:Paradito 0 21.314056 50.402682
## trt20 (Intercept)
## central valleys:Chile de Agua -30.2384364 3.051212
## central valleys:Taviche -36.8374161 10.259226
## central valleys:Tusta 29.1244024 -18.661214
## ecoast: 24.6870479 24.266598
## ecoast:Chigole -62.2743850 38.386529
## ecoast:Chile Bolita 1.0308533 20.963845
## ecoast:Chile de Monte 24.6234283 6.113152
## ecoast:Costeno Rojo -25.5853078 -8.476734
## ecoast:Frutescens 46.0069948 -1.480493
## ecoast:Guajillo -10.6239729 7.304466
## ecoast:Guina Dahni -37.3625281 -37.463496
## ecoast:Mareno -0.3321997 -7.951664
## ecoast:Mirasol -3.8079753 16.950053
## ecoast:Payaso -17.0541393 -23.648509
## ecoast:Solterito 21.5492144 26.867941
## ecoast:Tusta 68.9015719 -2.979411
## sierra madre:Tusta 41.3541489 -9.114573
## wcoast:Costeno Amarillo -52.0952997 -17.331256
## wcoast:Costeno Rojo -35.7101452 -23.255759
## wcoast:Piquin 11.8267861 12.011582
## yucatan:Dulce -41.2985803 -24.875335
## yucatan:Paradito 84.1159376 9.063839
##
## $`rep:run`
## (Intercept)
## 1:1 7.5999160
## 1:2 -7.4123840
## 2:3 -11.3527878
## 2:4 -0.5811445
## 3:5 3.6813092
## 3:6 -4.4962307
## 4:7 14.0602903
## 4:8 -1.4989684
##
## $cultivation
## (Intercept)
## 3.378235e-13
## Backyard 2.244461e-12
## Forest 1.362964e-13
## Milpa -1.922691e-12
## Plantation -7.958900e-13
##
## $region
## (Intercept) trt10 trt15 trt20 (Intercept)
## central valleys 0 -5.0896632 -7.1806026 0.032427861 -0.2168417
## ecoast 0 3.9128192 5.5202866 -0.024929813 2.3850057
## sierra madre 0 -1.2910816 -1.8214847 0.008225891 -0.3693707
## wcoast 0 1.7690271 2.4957801 -0.011271034 -1.1580278
## yucatan 0 0.6988985 0.9860206 -0.004452904 -0.6407655
##
## $rep
## (Intercept)
## 1 0.07836021
## 2 -4.98659311
## 3 -0.34051493
## 4 5.24874783
dotplot(ranef)
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## $`region:landrace.name`

##
## $`rep:run`

##
## $cultivation

##
## $region

##
## $rep

which(residuals(uniform.a2) > 200)
## 830 2419 2608 6247 7770 8070 8610 9388
## 61 179 194 484 618 637 675 727
uniform.b1 <- lmer(uniform ~ trt + (1|cultivation) + (trt|cultivation) + (1|cultivation:landrace.name) + (1|region) + (0+trt|cultivation:landrace.name)
+ (1|rep) + (1|rep:run), data = sum, REML = T)
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
summary(uniform.b1)
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Error in calculation of the Satterthwaite's approximation. The output of lme4 package is returned
## summary from lme4 is returned
## some computational error has occurred in lmerTest
## Linear mixed model fit by REML ['lmerMod']
## Formula: uniform ~ trt + (1 | cultivation) + (trt | cultivation) + (1 |
## cultivation:landrace.name) + (1 | region) + (0 + trt | cultivation:landrace.name) +
## (1 | rep) + (1 | rep:run)
## Data: sum
##
## REML criterion at convergence: 9125.2
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.1157 -0.6238 -0.1505 0.4093 6.3613
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## cultivation.landrace.name trt0 97.27 9.862
## trt10 194.43 13.944 0.75
## trt15 549.10 23.433 0.26 0.83
## trt20 933.53 30.554 -0.71 -0.07
## cultivation.landrace.name.1 (Intercept) 194.05 13.930
## rep.run (Intercept) 112.81 10.621
## region (Intercept) 139.28 11.802
## cultivation (Intercept) 116.17 10.778
## trt10 201.15 14.183 1.00
## trt15 606.39 24.625 1.00 1.00
## trt20 770.25 27.753 1.00 1.00
## cultivation.1 (Intercept) 0.00 0.000
## rep (Intercept) 52.32 7.234
## Residual 2989.94 54.680
##
##
##
##
## 0.50
##
##
##
##
##
##
## 1.00
##
##
##
## Number of obs: 837, groups:
## cultivation:landrace.name, 23; rep:run, 8; region, 5; cultivation, 5; rep, 4
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 57.811 10.758 5.374
## trt10 12.461 8.753 1.424
## trt15 18.959 14.318 1.324
## trt20 34.367 18.265 1.882
##
## Correlation of Fixed Effects:
## (Intr) trt10 trt15
## trt10 0.239
## trt15 0.291 0.858
## trt20 0.191 0.722 0.807
## convergence code: 0
## unable to evaluate scaled gradient
## Model failed to converge: degenerate Hessian with 1 negative eigenvalues
anova(uniform.b1) #error in calculation
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Error in calculation of the Satterthwaite's approximation. The output of lme4 package is returned
## anova from lme4 is returned
## some computational error has occurred in lmerTest
## Analysis of Variance Table
## Df Sum Sq Mean Sq F value
## trt 3 11457 3819 1.2773
anova(uniform.b1, ddf = "Kenward-Roger") #trt not significant
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Analysis of Variance Table of type III with Kenward-Roger
## approximation for degrees of freedom
## Sum Sq Mean Sq NumDF DenDF F.value Pr(>F)
## trt 1172.1 390.7 3 0.36206 0.13067 0.9301
rand(uniform.b1) #cultivation:landrace significant at p = 0.003, run within rep significant at p = 0.02
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Analysis of Random effects Table:
## Chi.sq Chi.DF p.value
## cultivation 0.000 1 1.000
## trt:cultivation 6.320 10 0.788
## cultivation:landrace.name 0.000 1 1.000
## region 10.427 1 0.001 **
## trt:cultivation:landrace.name 8.114 10 0.618
## rep 0.178 1 0.673
## rep:run 7.675 1 0.006 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(residuals(uniform.b1))
hist(residuals(uniform.b1))
plot(fitted(uniform.b1), residuals(uniform.b1))
qqnorm(resid(uniform.b1)) #check normal distribution of residuals
qqline(resid(uniform.b1)) #indicates right skew

ranef<- ranef(uniform.b1, condVar = T) #extract conditional means
## Warning in ranef.merMod(uniform.b1, condVar = T): conditional variances not
## currently available via ranef when there are multiple terms per factor
ranef
## $`cultivation:landrace.name`
## trt0 trt10 trt15
## : 2.9466955 6.2993037 9.6100590
## :Tusta -8.6375890 -9.1625200 -5.2602120
## Backyard:Chigole 16.3062930 7.5366064 -14.1075151
## Backyard:Chile Bolita 3.6749009 2.4737281 -1.2701970
## Backyard:Frutescens -6.4805457 -5.3571491 -0.2100438
## Backyard:Guajillo -1.1739997 -3.7170512 -6.8020976
## Backyard:Mareno -4.1929234 -7.1421824 -9.1891403
## Backyard:Mirasol 0.9844070 -2.5627000 -8.2834094
## Backyard:Paradito -4.6926290 6.7951642 26.1359101
## Backyard:Piquin 11.2557633 20.6075988 28.2010933
## Backyard:Solterito 3.6347063 6.3328186 8.3142313
## Backyard:Tusta -12.9123646 -16.6860356 -15.2244900
## Forest:Chile de Monte -0.1203866 3.0167455 7.6706163
## Milpa:Chile de Agua -0.3044441 2.7994835 7.5043008
## Milpa:Costeno Rojo 1.9609964 -5.6418690 -17.8230811
## Milpa:Dulce 1.4145601 -3.4084575 -11.2280545
## Milpa:Payaso -4.8174160 -7.8381905 -9.6521080
## Milpa:Taviche 5.1308315 5.4561801 3.1579579
## Milpa:Tusta -2.5860176 10.7943174 31.7643481
## Plantation:Chile de Agua -1.6507930 -4.3072203 -7.3003143
## Plantation:Costeno Amarillo 2.3912593 -0.7218131 -6.5682985
## Plantation:Costeno Rojo 2.7483077 6.7157633 11.0331388
## Plantation:Guina Dahni -4.8796123 -12.2825208 -20.4726938
## trt20 (Intercept)
## : 0.9976566 7.8449770
## :Tusta 18.9586774 -3.0790652
## Backyard:Chigole -58.7516154 5.1788346
## Backyard:Chile Bolita -11.4170468 2.5089517
## Backyard:Frutescens 17.7933061 -3.4637734
## Backyard:Guajillo -3.2375893 -1.9833526
## Backyard:Mareno 2.8646896 -9.8555061
## Backyard:Mirasol -10.6455809 1.3603529
## Backyard:Paradito 37.9944745 8.6126480
## Backyard:Piquin -4.3153162 3.5197698
## Backyard:Solterito -2.1504478 7.8413524
## Backyard:Tusta 21.3102314 -6.3206641
## Forest:Chile de Monte 7.6611978 0.6231948
## Milpa:Chile de Agua 8.0133899 3.8086933
## Milpa:Costeno Rojo -22.4694308 -7.2081719
## Milpa:Dulce -14.6526568 -10.3986251
## Milpa:Payaso 4.1564370 -11.5463271
## Milpa:Taviche -11.2298464 11.6666913
## Milpa:Tusta 37.5214931 1.5563404
## Plantation:Chile de Agua -2.3896151 19.2675026
## Plantation:Costeno Amarillo -12.9135945 -0.5636024
## Plantation:Costeno Rojo 2.9078201 -0.9544898
## Plantation:Guina Dahni -6.0066336 -18.4157312
##
## $`rep:run`
## (Intercept)
## 1:1 7.8692867
## 1:2 -7.6213262
## 2:3 -11.4909912
## 2:4 -0.5086478
## 3:5 3.5847358
## 3:6 -4.4499513
## 4:7 14.4199215
## 4:8 -1.8030275
##
## $region
## (Intercept)
## central valleys -1.846986
## ecoast 14.586232
## sierra madre -2.210098
## wcoast -9.247206
## yucatan -1.281942
##
## $cultivation
## (Intercept) trt10 trt15 trt20 (Intercept)
## 6.467554 8.510588 14.77653 16.65373 0
## Backyard 8.494846 11.178281 19.40832 21.87393 0
## Forest 4.666734 6.140907 10.66217 12.01668 0
## Milpa -7.524807 -9.901817 -17.19206 -19.37612 0
## Plantation -12.104326 -15.927960 -27.65497 -31.16822 0
##
## $rep
## (Intercept)
## 1 0.1150048
## 2 -5.5654701
## 3 -0.4012896
## 4 5.8517549
dotplot(ranef)
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## $`cultivation:landrace.name`

##
## $`rep:run`

##
## $region

##
## $cultivation

##
## $rep

which(residuals(uniform.b1) > 300)
## 6247
## 484
uniform.b2 <- lmer(uniform ~ trt + (1|cultivation) + (trt|cultivation) + (1|cultivation:landrace.name) + (1|region) + (0+trt|cultivation:landrace.name)
+ (1|rep) + (1|rep:run), data = sum, REML = T)
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
summary(uniform.b2)
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Error in calculation of the Satterthwaite's approximation. The output of lme4 package is returned
## summary from lme4 is returned
## some computational error has occurred in lmerTest
## Linear mixed model fit by REML ['lmerMod']
## Formula: uniform ~ trt + (1 | cultivation) + (trt | cultivation) + (1 |
## cultivation:landrace.name) + (1 | region) + (0 + trt | cultivation:landrace.name) +
## (1 | rep) + (1 | rep:run)
## Data: sum
##
## REML criterion at convergence: 9125.2
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.1157 -0.6238 -0.1505 0.4093 6.3613
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## cultivation.landrace.name trt0 97.27 9.862
## trt10 194.43 13.944 0.75
## trt15 549.10 23.433 0.26 0.83
## trt20 933.53 30.554 -0.71 -0.07
## cultivation.landrace.name.1 (Intercept) 194.05 13.930
## rep.run (Intercept) 112.81 10.621
## region (Intercept) 139.28 11.802
## cultivation (Intercept) 116.17 10.778
## trt10 201.15 14.183 1.00
## trt15 606.39 24.625 1.00 1.00
## trt20 770.25 27.753 1.00 1.00
## cultivation.1 (Intercept) 0.00 0.000
## rep (Intercept) 52.32 7.234
## Residual 2989.94 54.680
##
##
##
##
## 0.50
##
##
##
##
##
##
## 1.00
##
##
##
## Number of obs: 837, groups:
## cultivation:landrace.name, 23; rep:run, 8; region, 5; cultivation, 5; rep, 4
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 57.811 10.758 5.374
## trt10 12.461 8.753 1.424
## trt15 18.959 14.318 1.324
## trt20 34.367 18.265 1.882
##
## Correlation of Fixed Effects:
## (Intr) trt10 trt15
## trt10 0.239
## trt15 0.291 0.858
## trt20 0.191 0.722 0.807
## convergence code: 0
## unable to evaluate scaled gradient
## Model failed to converge: degenerate Hessian with 1 negative eigenvalues
anova(uniform.b2) #error in calculation
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Error in calculation of the Satterthwaite's approximation. The output of lme4 package is returned
## anova from lme4 is returned
## some computational error has occurred in lmerTest
## Analysis of Variance Table
## Df Sum Sq Mean Sq F value
## trt 3 11457 3819 1.2773
anova(uniform.b2, ddf = "Kenward-Roger") #trt not significant
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Analysis of Variance Table of type III with Kenward-Roger
## approximation for degrees of freedom
## Sum Sq Mean Sq NumDF DenDF F.value Pr(>F)
## trt 1172.1 390.7 3 0.36206 0.13067 0.9301
rand(uniform.b2) #cultivation:landrace significant at p = 0.003, run within rep significant at p = 0.02
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Analysis of Random effects Table:
## Chi.sq Chi.DF p.value
## cultivation 0.000 1 1.000
## trt:cultivation 6.320 10 0.788
## cultivation:landrace.name 0.000 1 1.000
## region 10.427 1 0.001 **
## trt:cultivation:landrace.name 8.114 10 0.618
## rep 0.178 1 0.673
## rep:run 7.675 1 0.006 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(residuals(uniform.b2))
hist(residuals(uniform.b2))
plot(fitted(uniform.b2), residuals(uniform.b2))
qqnorm(resid(uniform.b2)) #check normal distribution of residuals
qqline(resid(uniform.b2)) #indicates right skew

ranef<- ranef(uniform.b2, condVar = T) #extract conditional means
## Warning in ranef.merMod(uniform.b2, condVar = T): conditional variances not
## currently available via ranef when there are multiple terms per factor
ranef
## $`cultivation:landrace.name`
## trt0 trt10 trt15
## : 2.9466955 6.2993037 9.6100590
## :Tusta -8.6375890 -9.1625200 -5.2602120
## Backyard:Chigole 16.3062930 7.5366064 -14.1075151
## Backyard:Chile Bolita 3.6749009 2.4737281 -1.2701970
## Backyard:Frutescens -6.4805457 -5.3571491 -0.2100438
## Backyard:Guajillo -1.1739997 -3.7170512 -6.8020976
## Backyard:Mareno -4.1929234 -7.1421824 -9.1891403
## Backyard:Mirasol 0.9844070 -2.5627000 -8.2834094
## Backyard:Paradito -4.6926290 6.7951642 26.1359101
## Backyard:Piquin 11.2557633 20.6075988 28.2010933
## Backyard:Solterito 3.6347063 6.3328186 8.3142313
## Backyard:Tusta -12.9123646 -16.6860356 -15.2244900
## Forest:Chile de Monte -0.1203866 3.0167455 7.6706163
## Milpa:Chile de Agua -0.3044441 2.7994835 7.5043008
## Milpa:Costeno Rojo 1.9609964 -5.6418690 -17.8230811
## Milpa:Dulce 1.4145601 -3.4084575 -11.2280545
## Milpa:Payaso -4.8174160 -7.8381905 -9.6521080
## Milpa:Taviche 5.1308315 5.4561801 3.1579579
## Milpa:Tusta -2.5860176 10.7943174 31.7643481
## Plantation:Chile de Agua -1.6507930 -4.3072203 -7.3003143
## Plantation:Costeno Amarillo 2.3912593 -0.7218131 -6.5682985
## Plantation:Costeno Rojo 2.7483077 6.7157633 11.0331388
## Plantation:Guina Dahni -4.8796123 -12.2825208 -20.4726938
## trt20 (Intercept)
## : 0.9976566 7.8449770
## :Tusta 18.9586774 -3.0790652
## Backyard:Chigole -58.7516154 5.1788346
## Backyard:Chile Bolita -11.4170468 2.5089517
## Backyard:Frutescens 17.7933061 -3.4637734
## Backyard:Guajillo -3.2375893 -1.9833526
## Backyard:Mareno 2.8646896 -9.8555061
## Backyard:Mirasol -10.6455809 1.3603529
## Backyard:Paradito 37.9944745 8.6126480
## Backyard:Piquin -4.3153162 3.5197698
## Backyard:Solterito -2.1504478 7.8413524
## Backyard:Tusta 21.3102314 -6.3206641
## Forest:Chile de Monte 7.6611978 0.6231948
## Milpa:Chile de Agua 8.0133899 3.8086933
## Milpa:Costeno Rojo -22.4694308 -7.2081719
## Milpa:Dulce -14.6526568 -10.3986251
## Milpa:Payaso 4.1564370 -11.5463271
## Milpa:Taviche -11.2298464 11.6666913
## Milpa:Tusta 37.5214931 1.5563404
## Plantation:Chile de Agua -2.3896151 19.2675026
## Plantation:Costeno Amarillo -12.9135945 -0.5636024
## Plantation:Costeno Rojo 2.9078201 -0.9544898
## Plantation:Guina Dahni -6.0066336 -18.4157312
##
## $`rep:run`
## (Intercept)
## 1:1 7.8692867
## 1:2 -7.6213262
## 2:3 -11.4909912
## 2:4 -0.5086478
## 3:5 3.5847358
## 3:6 -4.4499513
## 4:7 14.4199215
## 4:8 -1.8030275
##
## $region
## (Intercept)
## central valleys -1.846986
## ecoast 14.586232
## sierra madre -2.210098
## wcoast -9.247206
## yucatan -1.281942
##
## $cultivation
## (Intercept) trt10 trt15 trt20 (Intercept)
## 6.467554 8.510588 14.77653 16.65373 0
## Backyard 8.494846 11.178281 19.40832 21.87393 0
## Forest 4.666734 6.140907 10.66217 12.01668 0
## Milpa -7.524807 -9.901817 -17.19206 -19.37612 0
## Plantation -12.104326 -15.927960 -27.65497 -31.16822 0
##
## $rep
## (Intercept)
## 1 0.1150048
## 2 -5.5654701
## 3 -0.4012896
## 4 5.8517549
dotplot(ranef)
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## $`cultivation:landrace.name`

##
## $`rep:run`

##
## $region

##
## $cultivation

##
## $rep

which(residuals(uniform.b2) > 300)
## 6247
## 484
#####
#TOTAL PRECENT GERM
#####
#percgerm is a percent value, so the data is left skewed. We account for this by using glmer with a guassian or logistic linking function.
perc_germ.a1 <- glmer(perc_germ ~ trt + (1|region) + (trt|region) + (1|cultivation) + (1|region:landrace.name) + (0+trt|region:landrace.name)
+ (1|rep) + (1|rep:run), data = sum, family = gaussian(link = "identity"), REML = T)
## Warning in glmer(perc_germ ~ trt + (1 | region) + (trt | region) + (1
## | : calling glmer() with family=gaussian (identity link) as a shortcut to
## lmer() is deprecated; please call lmer() directly
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in optwrap(optimizer, devfun, getStart(start, rho$lower, rho$pp), :
## convergence code 1 from bobyqa: bobyqa -- maximum number of function
## evaluations exceeded
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 2 negative
## eigenvalues
summary(perc_germ.a1)
## Linear mixed model fit by REML ['lmerMod']
## Formula:
## perc_germ ~ trt + (1 | region) + (trt | region) + (1 | cultivation) +
## (1 | region:landrace.name) + (0 + trt | region:landrace.name) +
## (1 | rep) + (1 | rep:run)
## Data: sum
##
## REML criterion at convergence: -552.8
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -5.3453 -0.1267 0.1024 0.5200 3.0216
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## region.landrace.name trt0 0.000e+00 0.000000
## trt10 4.048e-03 0.063628 NaN
## trt15 1.748e-02 0.132210 NaN 1.00
## trt20 4.997e-02 0.223539 NaN 0.91 0.91
## region.landrace.name.1 (Intercept) 0.000e+00 0.000000
## rep.run (Intercept) 2.755e-03 0.052493
## cultivation (Intercept) 0.000e+00 0.000000
## region (Intercept) 6.921e-06 0.002631
## trt10 4.586e-04 0.021414 1.00
## trt15 4.097e-03 0.064005 1.00 1.00
## trt20 4.102e-02 0.202546 1.00 1.00 1.00
## region.1 (Intercept) 0.000e+00 0.000000
## rep (Intercept) 0.000e+00 0.000000
## Residual 3.074e-02 0.175323
## Number of obs: 1045, groups:
## region:landrace.name, 22; rep:run, 8; cultivation, 5; region, 5; rep, 4
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 0.96951 0.02153 45.02
## trt10 -0.05329 0.02320 -2.30
## trt15 -0.10482 0.04544 -2.31
## trt20 -0.36541 0.10997 -3.32
##
## Correlation of Fixed Effects:
## (Intr) trt10 trt15
## trt10 -0.204
## trt15 -0.078 0.812
## trt20 0.002 0.684 0.879
## convergence code: 1
## unable to evaluate scaled gradient
## Model failed to converge: degenerate Hessian with 2 negative eigenvalues
anova(perc_germ.a1) #trt not significant
## Analysis of Variance Table
## Df Sum Sq Mean Sq F value
## trt 3 0.42195 0.14065 4.5757
rand(perc_germ.a1) #region significant at p= 0.1, trt:region:landrace significant at p < 0.0001, run within rep significant at p < 0.0001
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in optwrap(optimizer, devfun, getStart(start, rho$lower, rho$pp), :
## convergence code 1 from bobyqa: bobyqa -- maximum number of function
## evaluations exceeded
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 3 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 2 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in optwrap(optimizer, devfun, getStart(start, rho$lower, rho$pp), :
## convergence code 1 from bobyqa: bobyqa -- maximum number of function
## evaluations exceeded
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 3 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in optwrap(optimizer, devfun, getStart(start, rho$lower, rho$pp), :
## convergence code 1 from bobyqa: bobyqa -- maximum number of function
## evaluations exceeded
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 3 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Analysis of Random effects Table:
## Chi.sq Chi.DF p.value
## region 5.85e-02 1 0.8
## trt:region 8.45e+00 10 0.6
## cultivation 0.00e+00 1 1.0
## region:landrace.name 5.86e-02 1 0.8
## trt:region:landrace.name 8.42e+01 10 8e-14 ***
## rep 1.38e-04 1 1.0
## rep:run 4.87e+01 1 3e-12 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(residuals(perc_germ.a1))
hist(residuals(perc_germ.a1))
plot(fitted(perc_germ.a1), residuals(perc_germ.a1))
qqnorm(resid(perc_germ.a1)) #check normal distribution of residuals
qqline(resid(perc_germ.a1)) #uneven tails, heavy

ranef<- ranef(perc_germ.a1, condVar = T) #extract conditional means
## Warning in ranef.merMod(perc_germ.a1, condVar = T): conditional variances
## not currently available via ranef when there are multiple terms per factor
ranef
## $`region:landrace.name`
## trt0 trt10 trt15 trt20
## central valleys:Chile de Agua 0 -0.0001221792 -0.0003654432 0.02878455
## central valleys:Taviche 0 0.0186461953 0.0387795976 0.05114467
## central valleys:Tusta 0 -0.0143612341 -0.0299572279 -0.01664345
## ecoast: 0 -0.0826464344 -0.1717605783 -0.25738304
## ecoast:Chigole 0 0.0345381425 0.0719243999 0.07114646
## ecoast:Chile Bolita 0 0.0210562237 0.0440701976 -0.01462051
## ecoast:Chile de Monte 0 -0.0827044682 -0.1718451307 -0.26599565
## ecoast:Costeno Rojo 0 0.0533541668 0.1103995103 0.29022354
## ecoast:Frutescens 0 0.0348431266 0.0725037062 0.08513317
## ecoast:Guajillo 0 -0.1033938906 -0.2149967739 -0.29158046
## ecoast:Guina Dahni 0 0.0878064535 0.1824017295 0.29427523
## ecoast:Mareno 0 -0.0398296652 -0.0826235999 -0.16345289
## ecoast:Mirasol 0 -0.0316857508 -0.0656138918 -0.15896186
## ecoast:Payaso 0 0.0787490239 0.1635116073 0.28309683
## ecoast:Solterito 0 -0.0934183799 -0.1942873798 -0.25477447
## ecoast:Tusta 0 0.0331374927 0.0690747949 0.05002125
## sierra madre:Tusta 0 0.0207107282 0.0429963294 0.07605101
## wcoast:Costeno Amarillo 0 0.0530634694 0.1101618834 0.19520508
## wcoast:Costeno Rojo 0 0.0273302189 0.0565297315 0.15331732
## wcoast:Piquin 0 -0.0639776880 -0.1327602136 -0.25018366
## yucatan:Dulce 0 0.0738606542 0.1531939319 0.30847950
## yucatan:Paradito 0 -0.0249562054 -0.0513371803 -0.21328258
## (Intercept)
## central valleys:Chile de Agua 0
## central valleys:Taviche 0
## central valleys:Tusta 0
## ecoast: 0
## ecoast:Chigole 0
## ecoast:Chile Bolita 0
## ecoast:Chile de Monte 0
## ecoast:Costeno Rojo 0
## ecoast:Frutescens 0
## ecoast:Guajillo 0
## ecoast:Guina Dahni 0
## ecoast:Mareno 0
## ecoast:Mirasol 0
## ecoast:Payaso 0
## ecoast:Solterito 0
## ecoast:Tusta 0
## sierra madre:Tusta 0
## wcoast:Costeno Amarillo 0
## wcoast:Costeno Rojo 0
## wcoast:Piquin 0
## yucatan:Dulce 0
## yucatan:Paradito 0
##
## $`rep:run`
## (Intercept)
## 1:1 -0.08482142
## 1:2 0.03813788
## 2:3 0.04730963
## 2:4 -0.01421723
## 3:5 0.04349401
## 3:6 0.02228811
## 4:7 -0.06298479
## 4:8 0.01079381
##
## $cultivation
## (Intercept)
## 0
## Backyard 0
## Forest 0
## Milpa 0
## Plantation 0
##
## $region
## (Intercept) trt10 trt15 trt20
## central valleys 0.0021293463 0.017333132 0.05180692 0.16394349
## ecoast -0.0031860890 -0.025935134 -0.07751741 -0.24530457
## sierra madre 0.0006627416 0.005394792 0.01612447 0.05102604
## wcoast 0.0017469041 0.014220002 0.04250210 0.13449830
## yucatan -0.0013529030 -0.011012792 -0.03291608 -0.10416326
## (Intercept)
## central valleys 0
## ecoast 0
## sierra madre 0
## wcoast 0
## yucatan 0
##
## $rep
## (Intercept)
## 1 0
## 2 0
## 3 0
## 4 0
dotplot(ranef)
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## $`region:landrace.name`

##
## $`rep:run`

##
## $cultivation

##
## $region

##
## $rep

which(residuals(perc_germ.a1) < -.6)
## 511 1039 1519 3228 7153 7268 7890 8730 9009 9039 9208 10336
## 49 101 147 313 692 704 763 844 872 875 892 1003
## 10396
## 1008
perc_germ.a2 <- glmer(perc_germ ~ trt + (1|region) + (trt|region) + (1|cultivation) + (1|region:landrace.name) + (0+trt|region:landrace.name)
+ (1|rep) + (1|rep:run), data = sum, family = gaussian(link = "identity"), REML = T)
## Warning in glmer(perc_germ ~ trt + (1 | region) + (trt | region) + (1
## | : calling glmer() with family=gaussian (identity link) as a shortcut to
## lmer() is deprecated; please call lmer() directly
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in optwrap(optimizer, devfun, getStart(start, rho$lower, rho$pp), :
## convergence code 1 from bobyqa: bobyqa -- maximum number of function
## evaluations exceeded
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 2 negative
## eigenvalues
summary(perc_germ.a2)
## Linear mixed model fit by REML ['lmerMod']
## Formula:
## perc_germ ~ trt + (1 | region) + (trt | region) + (1 | cultivation) +
## (1 | region:landrace.name) + (0 + trt | region:landrace.name) +
## (1 | rep) + (1 | rep:run)
## Data: sum
##
## REML criterion at convergence: -552.8
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -5.3453 -0.1267 0.1024 0.5200 3.0216
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## region.landrace.name trt0 0.000e+00 0.000000
## trt10 4.048e-03 0.063628 NaN
## trt15 1.748e-02 0.132210 NaN 1.00
## trt20 4.997e-02 0.223539 NaN 0.91 0.91
## region.landrace.name.1 (Intercept) 0.000e+00 0.000000
## rep.run (Intercept) 2.755e-03 0.052493
## cultivation (Intercept) 0.000e+00 0.000000
## region (Intercept) 6.921e-06 0.002631
## trt10 4.586e-04 0.021414 1.00
## trt15 4.097e-03 0.064005 1.00 1.00
## trt20 4.102e-02 0.202546 1.00 1.00 1.00
## region.1 (Intercept) 0.000e+00 0.000000
## rep (Intercept) 0.000e+00 0.000000
## Residual 3.074e-02 0.175323
## Number of obs: 1045, groups:
## region:landrace.name, 22; rep:run, 8; cultivation, 5; region, 5; rep, 4
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 0.96951 0.02153 45.02
## trt10 -0.05329 0.02320 -2.30
## trt15 -0.10482 0.04544 -2.31
## trt20 -0.36541 0.10997 -3.32
##
## Correlation of Fixed Effects:
## (Intr) trt10 trt15
## trt10 -0.204
## trt15 -0.078 0.812
## trt20 0.002 0.684 0.879
## convergence code: 1
## unable to evaluate scaled gradient
## Model failed to converge: degenerate Hessian with 2 negative eigenvalues
anova(perc_germ.a2) #trt not significant
## Analysis of Variance Table
## Df Sum Sq Mean Sq F value
## trt 3 0.42195 0.14065 4.5757
rand(perc_germ.a2) #region significant at p= 0.1, trt:region:landrace significant at p < 0.0001, run within rep significant at p < 0.0001
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in optwrap(optimizer, devfun, getStart(start, rho$lower, rho$pp), :
## convergence code 1 from bobyqa: bobyqa -- maximum number of function
## evaluations exceeded
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 3 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 2 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in optwrap(optimizer, devfun, getStart(start, rho$lower, rho$pp), :
## convergence code 1 from bobyqa: bobyqa -- maximum number of function
## evaluations exceeded
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 3 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in optwrap(optimizer, devfun, getStart(start, rho$lower, rho$pp), :
## convergence code 1 from bobyqa: bobyqa -- maximum number of function
## evaluations exceeded
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 3 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Analysis of Random effects Table:
## Chi.sq Chi.DF p.value
## region 5.85e-02 1 0.8
## trt:region 8.45e+00 10 0.6
## cultivation 0.00e+00 1 1.0
## region:landrace.name 5.86e-02 1 0.8
## trt:region:landrace.name 8.42e+01 10 8e-14 ***
## rep 1.38e-04 1 1.0
## rep:run 4.87e+01 1 3e-12 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(residuals(perc_germ.a2))
hist(residuals(perc_germ.a2))
plot(fitted(perc_germ.a2), residuals(perc_germ.a2))
qqnorm(resid(perc_germ.a2)) #check normal distribution of residuals
qqline(resid(perc_germ.a2)) #uneven tails, heavy

ranef<- ranef(perc_germ.a2, condVar = T) #extract conditional means
## Warning in ranef.merMod(perc_germ.a2, condVar = T): conditional variances
## not currently available via ranef when there are multiple terms per factor
ranef
## $`region:landrace.name`
## trt0 trt10 trt15 trt20
## central valleys:Chile de Agua 0 -0.0001221792 -0.0003654432 0.02878455
## central valleys:Taviche 0 0.0186461953 0.0387795976 0.05114467
## central valleys:Tusta 0 -0.0143612341 -0.0299572279 -0.01664345
## ecoast: 0 -0.0826464344 -0.1717605783 -0.25738304
## ecoast:Chigole 0 0.0345381425 0.0719243999 0.07114646
## ecoast:Chile Bolita 0 0.0210562237 0.0440701976 -0.01462051
## ecoast:Chile de Monte 0 -0.0827044682 -0.1718451307 -0.26599565
## ecoast:Costeno Rojo 0 0.0533541668 0.1103995103 0.29022354
## ecoast:Frutescens 0 0.0348431266 0.0725037062 0.08513317
## ecoast:Guajillo 0 -0.1033938906 -0.2149967739 -0.29158046
## ecoast:Guina Dahni 0 0.0878064535 0.1824017295 0.29427523
## ecoast:Mareno 0 -0.0398296652 -0.0826235999 -0.16345289
## ecoast:Mirasol 0 -0.0316857508 -0.0656138918 -0.15896186
## ecoast:Payaso 0 0.0787490239 0.1635116073 0.28309683
## ecoast:Solterito 0 -0.0934183799 -0.1942873798 -0.25477447
## ecoast:Tusta 0 0.0331374927 0.0690747949 0.05002125
## sierra madre:Tusta 0 0.0207107282 0.0429963294 0.07605101
## wcoast:Costeno Amarillo 0 0.0530634694 0.1101618834 0.19520508
## wcoast:Costeno Rojo 0 0.0273302189 0.0565297315 0.15331732
## wcoast:Piquin 0 -0.0639776880 -0.1327602136 -0.25018366
## yucatan:Dulce 0 0.0738606542 0.1531939319 0.30847950
## yucatan:Paradito 0 -0.0249562054 -0.0513371803 -0.21328258
## (Intercept)
## central valleys:Chile de Agua 0
## central valleys:Taviche 0
## central valleys:Tusta 0
## ecoast: 0
## ecoast:Chigole 0
## ecoast:Chile Bolita 0
## ecoast:Chile de Monte 0
## ecoast:Costeno Rojo 0
## ecoast:Frutescens 0
## ecoast:Guajillo 0
## ecoast:Guina Dahni 0
## ecoast:Mareno 0
## ecoast:Mirasol 0
## ecoast:Payaso 0
## ecoast:Solterito 0
## ecoast:Tusta 0
## sierra madre:Tusta 0
## wcoast:Costeno Amarillo 0
## wcoast:Costeno Rojo 0
## wcoast:Piquin 0
## yucatan:Dulce 0
## yucatan:Paradito 0
##
## $`rep:run`
## (Intercept)
## 1:1 -0.08482142
## 1:2 0.03813788
## 2:3 0.04730963
## 2:4 -0.01421723
## 3:5 0.04349401
## 3:6 0.02228811
## 4:7 -0.06298479
## 4:8 0.01079381
##
## $cultivation
## (Intercept)
## 0
## Backyard 0
## Forest 0
## Milpa 0
## Plantation 0
##
## $region
## (Intercept) trt10 trt15 trt20
## central valleys 0.0021293463 0.017333132 0.05180692 0.16394349
## ecoast -0.0031860890 -0.025935134 -0.07751741 -0.24530457
## sierra madre 0.0006627416 0.005394792 0.01612447 0.05102604
## wcoast 0.0017469041 0.014220002 0.04250210 0.13449830
## yucatan -0.0013529030 -0.011012792 -0.03291608 -0.10416326
## (Intercept)
## central valleys 0
## ecoast 0
## sierra madre 0
## wcoast 0
## yucatan 0
##
## $rep
## (Intercept)
## 1 0
## 2 0
## 3 0
## 4 0
dotplot(ranef)
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## $`region:landrace.name`

##
## $`rep:run`

##
## $cultivation

##
## $region

##
## $rep

which(residuals(perc_germ.a2) < -.6)
## 511 1039 1519 3228 7153 7268 7890 8730 9009 9039 9208 10336
## 49 101 147 313 692 704 763 844 872 875 892 1003
## 10396
## 1008
perc_germ.b1 <- glmer(perc_germ ~ trt + (1|cultivation) + (1|region) + (trt|cultivation) + (1|cultivation:landrace.name) + (0+trt|cultivation:landrace.name)
+ (1|rep) + (1|rep:run), data = sum, family = gaussian(link = "identity"), REML = T)
## Warning in glmer(perc_germ ~ trt + (1 | cultivation) + (1 | region) + (trt
## | : calling glmer() with family=gaussian (identity link) as a shortcut to
## lmer() is deprecated; please call lmer() directly
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
summary(perc_germ.b1)
## Linear mixed model fit by REML ['lmerMod']
## Formula:
## perc_germ ~ trt + (1 | cultivation) + (1 | region) + (trt | cultivation) +
## (1 | cultivation:landrace.name) + (0 + trt | cultivation:landrace.name) +
## (1 | rep) + (1 | rep:run)
## Data: sum
##
## REML criterion at convergence: -532.7
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.7528 -0.2294 0.1196 0.4805 2.9290
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## cultivation.landrace.name trt0 6.035e-04 0.024567
## trt10 2.240e-03 0.047326 1.00
## trt15 1.361e-02 0.116646 0.77 0.77
## trt20 2.651e-02 0.162818 0.48 0.48 0.93
## cultivation.landrace.name.1 (Intercept) 0.000e+00 0.000000
## rep.run (Intercept) 2.679e-03 0.051761
## cultivation (Intercept) 6.034e-05 0.007768
## trt10 1.666e-03 0.040811 1.00
## trt15 7.934e-03 0.089071 1.00 1.00
## trt20 6.896e-02 0.262611 1.00 1.00 1.00
## region (Intercept) 6.877e-04 0.026224
## cultivation.1 (Intercept) 0.000e+00 0.000000
## rep (Intercept) 0.000e+00 0.000000
## Residual 3.134e-02 0.177031
## Number of obs: 1045, groups:
## cultivation:landrace.name, 23; rep:run, 8; cultivation, 5; region, 5; rep, 4
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 0.97519 0.02599 37.53
## trt10 -0.06047 0.02491 -2.43
## trt15 -0.12810 0.04888 -2.62
## trt20 -0.45212 0.12637 -3.58
##
## Correlation of Fixed Effects:
## (Intr) trt10 trt15
## trt10 -0.034
## trt15 0.082 0.785
## trt20 0.109 0.777 0.924
## convergence code: 0
## unable to evaluate scaled gradient
## Model failed to converge: degenerate Hessian with 1 negative eigenvalues
anova(perc_germ.b1) #trt not significant
## Analysis of Variance Table
## Df Sum Sq Mean Sq F value
## trt 3 0.50176 0.16725 5.3367
rand(perc_germ.b1) #trt:cultivation significant at p= 0.03, trt:cultivation:landrace singificant at p<0.0001, run within rep significant at p<0.0001
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in optwrap(optimizer, devfun, getStart(start, rho$lower, rho$pp), :
## convergence code 1 from bobyqa: bobyqa -- maximum number of function
## evaluations exceeded
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Analysis of Random effects Table:
## Chi.sq Chi.DF p.value
## cultivation 0.00 1 1.00
## region 4.71 1 0.03 *
## trt:cultivation 18.02 10 0.05 .
## cultivation:landrace.name 2.87 1 0.09 .
## trt:cultivation:landrace.name 53.59 10 6e-08 ***
## rep 0.00 1 1.00
## rep:run 50.03 1 2e-12 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(residuals(perc_germ.b1))
hist(residuals(perc_germ.b1))
plot(fitted(perc_germ.b1), residuals(perc_germ.b1))
qqnorm(resid(perc_germ.b1)) #check normal distribution of residuals
qqline(resid(perc_germ.b1))

ranef<- ranef(perc_germ.b1, condVar = T) #extract conditional means
## Warning in ranef.merMod(perc_germ.b1, condVar = T): conditional variances
## not currently available via ranef when there are multiple terms per factor
ranef
## $`cultivation:landrace.name`
## trt0 trt10 trt15
## : -0.0328175248 -0.0632206183 -0.2417824351
## :Tusta 0.0080621585 0.0155311726 0.0976403470
## Backyard:Chigole 0.0200327365 0.0385916363 0.1201790982
## Backyard:Chile Bolita 0.0328639697 0.0633100910 0.0911353199
## Backyard:Frutescens 0.0217629137 0.0419246993 0.1147878936
## Backyard:Guajillo -0.0286354050 -0.0551640629 -0.1686822314
## Backyard:Mareno 0.0041841840 0.0080605318 -0.0464809476
## Backyard:Mirasol -0.0025668203 -0.0049447960 -0.0373850383
## Backyard:Paradito 0.0118048055 0.0227411148 0.0009890294
## Backyard:Piquin -0.0102433762 -0.0197331328 0.0332718547
## Backyard:Solterito -0.0322078785 -0.0620461782 -0.1569463363
## Backyard:Tusta 0.0224386274 0.0432264135 0.1622869363
## Forest:Chile de Monte -0.0290439927 -0.0559511781 -0.1077771074
## Milpa:Chile de Agua -0.0032582972 -0.0062768770 0.0236088298
## Milpa:Costeno Rojo -0.0004295042 -0.0008274091 0.0818684792
## Milpa:Dulce 0.0028068510 0.0054071980 0.0440079491
## Milpa:Payaso 0.0129857238 0.0250160696 0.0315282270
## Milpa:Taviche -0.0012567866 -0.0024211097 0.0270721692
## Milpa:Tusta -0.0021050530 -0.0040552342 -0.1275401857
## Plantation:Chile de Agua -0.0158619668 -0.0305569465 -0.0267529338
## Plantation:Costeno Amarillo 0.0071530962 0.0137799291 0.0763716875
## Plantation:Costeno Rojo -0.0061447804 -0.0118374807 -0.0138619126
## Plantation:Guina Dahni 0.0204763195 0.0394461674 0.0224613073
## trt20 (Intercept)
## : -0.337939423 0
## :Tusta 0.156021328 0
## Backyard:Chigole 0.153961698 0
## Backyard:Chile Bolita 0.050195052 0
## Backyard:Frutescens 0.137154244 0
## Backyard:Guajillo -0.214149594 0
## Backyard:Mareno -0.104485747 0
## Backyard:Mirasol -0.061696906 0
## Backyard:Paradito -0.042571441 0
## Backyard:Piquin 0.102091181 0
## Backyard:Solterito -0.178292317 0
## Backyard:Tusta 0.225280025 0
## Forest:Chile de Monte -0.096349310 0
## Milpa:Chile de Agua 0.057338202 0
## Milpa:Costeno Rojo 0.157895893 0
## Milpa:Dulce 0.073435338 0
## Milpa:Payaso 0.011277078 0
## Milpa:Taviche 0.056411239 0
## Milpa:Tusta -0.235532684 0
## Plantation:Chile de Agua 0.008670993 0
## Plantation:Costeno Amarillo 0.118845421 0
## Plantation:Costeno Rojo -0.003318386 0
## Plantation:Guina Dahni -0.034241883 0
##
## $`rep:run`
## (Intercept)
## 1:1 -0.084612233
## 1:2 0.039282327
## 2:3 0.045176462
## 2:4 -0.018575172
## 3:5 0.044056924
## 3:6 0.024054964
## 4:7 -0.057614410
## 4:8 0.008231137
##
## $cultivation
## (Intercept) trt10 trt15 trt20 (Intercept)
## 0.000349252 0.001834861 0.004004632 0.01180702 0
## Backyard -0.005997703 -0.031510051 -0.068771496 -0.20276189 0
## Forest -0.008632627 -0.045353109 -0.098984326 -0.29183964 0
## Milpa 0.006872096 0.036103837 0.078797552 0.23232213 0
## Plantation 0.007408981 0.038924462 0.084953638 0.25047238 0
##
## $region
## (Intercept)
## central valleys 0.003017604
## ecoast -0.030849405
## sierra madre 0.004624080
## wcoast 0.019702623
## yucatan 0.003505098
##
## $rep
## (Intercept)
## 1 0
## 2 0
## 3 0
## 4 0
dotplot(ranef)
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## $`cultivation:landrace.name`

##
## $`rep:run`

##
## $cultivation

##
## $region

##
## $rep

which(residuals(perc_germ.b1) < -.6)
## 511 910 1519 3228 4237 7153 7268 7540 7890 8440 8730 9009
## 49 88 147 313 409 692 704 731 763 816 844 872
## 9039 9208 10336 10396
## 875 892 1003 1008
perc_germ.b2 <- glmer(perc_germ ~ trt + (1|cultivation) + (1|region) + (trt|cultivation) + (1|cultivation:landrace.name) + (0+trt|cultivation:landrace.name)
+ (1|rep) + (1|rep:run), data = sum, family = gaussian(link = "identity"), REML = T)
## Warning in glmer(perc_germ ~ trt + (1 | cultivation) + (1 | region) + (trt
## | : calling glmer() with family=gaussian (identity link) as a shortcut to
## lmer() is deprecated; please call lmer() directly
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
summary(perc_germ.b2)
## Linear mixed model fit by REML ['lmerMod']
## Formula:
## perc_germ ~ trt + (1 | cultivation) + (1 | region) + (trt | cultivation) +
## (1 | cultivation:landrace.name) + (0 + trt | cultivation:landrace.name) +
## (1 | rep) + (1 | rep:run)
## Data: sum
##
## REML criterion at convergence: -532.7
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.7528 -0.2294 0.1196 0.4805 2.9290
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## cultivation.landrace.name trt0 6.035e-04 0.024567
## trt10 2.240e-03 0.047326 1.00
## trt15 1.361e-02 0.116646 0.77 0.77
## trt20 2.651e-02 0.162818 0.48 0.48 0.93
## cultivation.landrace.name.1 (Intercept) 0.000e+00 0.000000
## rep.run (Intercept) 2.679e-03 0.051761
## cultivation (Intercept) 6.034e-05 0.007768
## trt10 1.666e-03 0.040811 1.00
## trt15 7.934e-03 0.089071 1.00 1.00
## trt20 6.896e-02 0.262611 1.00 1.00 1.00
## region (Intercept) 6.877e-04 0.026224
## cultivation.1 (Intercept) 0.000e+00 0.000000
## rep (Intercept) 0.000e+00 0.000000
## Residual 3.134e-02 0.177031
## Number of obs: 1045, groups:
## cultivation:landrace.name, 23; rep:run, 8; cultivation, 5; region, 5; rep, 4
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 0.97519 0.02599 37.53
## trt10 -0.06047 0.02491 -2.43
## trt15 -0.12810 0.04888 -2.62
## trt20 -0.45212 0.12637 -3.58
##
## Correlation of Fixed Effects:
## (Intr) trt10 trt15
## trt10 -0.034
## trt15 0.082 0.785
## trt20 0.109 0.777 0.924
## convergence code: 0
## unable to evaluate scaled gradient
## Model failed to converge: degenerate Hessian with 1 negative eigenvalues
anova(perc_germ.b2) #trt not significant
## Analysis of Variance Table
## Df Sum Sq Mean Sq F value
## trt 3 0.50176 0.16725 5.3367
rand(perc_germ.b2) #trt:cultivation significant at p= 0.03, trt:cultivation:landrace singificant at p<0.0001, run within rep significant at p<0.0001
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning in optwrap(optimizer, devfun, getStart(start, rho$lower, rho$pp), :
## convergence code 1 from bobyqa: bobyqa -- maximum number of function
## evaluations exceeded
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
## $checkConv, : Model failed to converge: degenerate Hessian with 1 negative
## eigenvalues
## Analysis of Random effects Table:
## Chi.sq Chi.DF p.value
## cultivation 0.00 1 1.00
## region 4.71 1 0.03 *
## trt:cultivation 18.02 10 0.05 .
## cultivation:landrace.name 2.87 1 0.09 .
## trt:cultivation:landrace.name 53.59 10 6e-08 ***
## rep 0.00 1 1.00
## rep:run 50.03 1 2e-12 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(residuals(perc_germ.b2))
hist(residuals(perc_germ.b2))
plot(fitted(perc_germ.b2), residuals(perc_germ.b2))
qqnorm(resid(perc_germ.b2)) #check normal distribution of residuals
qqline(resid(perc_germ.b2))

ranef<- ranef(perc_germ.b2, condVar = T) #extract conditional means
## Warning in ranef.merMod(perc_germ.b2, condVar = T): conditional variances
## not currently available via ranef when there are multiple terms per factor
ranef
## $`cultivation:landrace.name`
## trt0 trt10 trt15
## : -0.0328175248 -0.0632206183 -0.2417824351
## :Tusta 0.0080621585 0.0155311726 0.0976403470
## Backyard:Chigole 0.0200327365 0.0385916363 0.1201790982
## Backyard:Chile Bolita 0.0328639697 0.0633100910 0.0911353199
## Backyard:Frutescens 0.0217629137 0.0419246993 0.1147878936
## Backyard:Guajillo -0.0286354050 -0.0551640629 -0.1686822314
## Backyard:Mareno 0.0041841840 0.0080605318 -0.0464809476
## Backyard:Mirasol -0.0025668203 -0.0049447960 -0.0373850383
## Backyard:Paradito 0.0118048055 0.0227411148 0.0009890294
## Backyard:Piquin -0.0102433762 -0.0197331328 0.0332718547
## Backyard:Solterito -0.0322078785 -0.0620461782 -0.1569463363
## Backyard:Tusta 0.0224386274 0.0432264135 0.1622869363
## Forest:Chile de Monte -0.0290439927 -0.0559511781 -0.1077771074
## Milpa:Chile de Agua -0.0032582972 -0.0062768770 0.0236088298
## Milpa:Costeno Rojo -0.0004295042 -0.0008274091 0.0818684792
## Milpa:Dulce 0.0028068510 0.0054071980 0.0440079491
## Milpa:Payaso 0.0129857238 0.0250160696 0.0315282270
## Milpa:Taviche -0.0012567866 -0.0024211097 0.0270721692
## Milpa:Tusta -0.0021050530 -0.0040552342 -0.1275401857
## Plantation:Chile de Agua -0.0158619668 -0.0305569465 -0.0267529338
## Plantation:Costeno Amarillo 0.0071530962 0.0137799291 0.0763716875
## Plantation:Costeno Rojo -0.0061447804 -0.0118374807 -0.0138619126
## Plantation:Guina Dahni 0.0204763195 0.0394461674 0.0224613073
## trt20 (Intercept)
## : -0.337939423 0
## :Tusta 0.156021328 0
## Backyard:Chigole 0.153961698 0
## Backyard:Chile Bolita 0.050195052 0
## Backyard:Frutescens 0.137154244 0
## Backyard:Guajillo -0.214149594 0
## Backyard:Mareno -0.104485747 0
## Backyard:Mirasol -0.061696906 0
## Backyard:Paradito -0.042571441 0
## Backyard:Piquin 0.102091181 0
## Backyard:Solterito -0.178292317 0
## Backyard:Tusta 0.225280025 0
## Forest:Chile de Monte -0.096349310 0
## Milpa:Chile de Agua 0.057338202 0
## Milpa:Costeno Rojo 0.157895893 0
## Milpa:Dulce 0.073435338 0
## Milpa:Payaso 0.011277078 0
## Milpa:Taviche 0.056411239 0
## Milpa:Tusta -0.235532684 0
## Plantation:Chile de Agua 0.008670993 0
## Plantation:Costeno Amarillo 0.118845421 0
## Plantation:Costeno Rojo -0.003318386 0
## Plantation:Guina Dahni -0.034241883 0
##
## $`rep:run`
## (Intercept)
## 1:1 -0.084612233
## 1:2 0.039282327
## 2:3 0.045176462
## 2:4 -0.018575172
## 3:5 0.044056924
## 3:6 0.024054964
## 4:7 -0.057614410
## 4:8 0.008231137
##
## $cultivation
## (Intercept) trt10 trt15 trt20 (Intercept)
## 0.000349252 0.001834861 0.004004632 0.01180702 0
## Backyard -0.005997703 -0.031510051 -0.068771496 -0.20276189 0
## Forest -0.008632627 -0.045353109 -0.098984326 -0.29183964 0
## Milpa 0.006872096 0.036103837 0.078797552 0.23232213 0
## Plantation 0.007408981 0.038924462 0.084953638 0.25047238 0
##
## $region
## (Intercept)
## central valleys 0.003017604
## ecoast -0.030849405
## sierra madre 0.004624080
## wcoast 0.019702623
## yucatan 0.003505098
##
## $rep
## (Intercept)
## 1 0
## 2 0
## 3 0
## 4 0
dotplot(ranef)
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
## $`cultivation:landrace.name`

##
## $`rep:run`

##
## $cultivation

##
## $region

##
## $rep

which(residuals(perc_germ.b2) < -.6)
## 511 910 1519 3228 4237 7153 7268 7540 7890 8440 8730 9009
## 49 88 147 313 409 692 704 731 763 816 844 872
## 9039 9208 10336 10396
## 875 892 1003 1008
#####
#ALL-RANDOM MODELS FOR CALCULATING HERITABILITY
#####
#VG = VG/(VG + VGT/t + Ve/r)
#Where VG is equal to your genetic variance,
#VGT is equal to your genotype x treatment variance,
#t is your number of treatments, Ve is your residual variance,
#and r is your number of reps.
###
delay.h <- lmer(delay ~ (1|trt) + (1|landrace.name) + (1|trt:landrace.name) + (1|rep) + (1|rep:run), data = sum, REML = T)
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
summary(delay.h)
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## summary from lme4 is returned
## some computational error has occurred in lmerTest
## Linear mixed model fit by REML ['lmerMod']
## Formula:
## delay ~ (1 | trt) + (1 | landrace.name) + (1 | trt:landrace.name) +
## (1 | rep) + (1 | rep:run)
## Data: sum
##
## REML criterion at convergence: 11880.3
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.6842 -0.5181 -0.1231 0.3485 6.0765
##
## Random effects:
## Groups Name Variance Std.Dev.
## trt:landrace.name (Intercept) 920.44 30.339
## landrace.name (Intercept) 3628.60 60.238
## rep:run (Intercept) 135.96 11.660
## rep (Intercept) 62.39 7.899
## trt (Intercept) 4594.01 67.779
## Residual 4427.06 66.536
## Number of obs: 1045, groups:
## trt:landrace.name, 76; landrace.name, 19; rep:run, 8; rep, 4; trt, 4
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 197.66 37.35 5.293
#3587.4/(3487.4 + 917.9/4 +4427.5/4) #0.74369
3628.6/(3628.6 + 920.44/4 + 4427.06/4) #.7308
## [1] 0.7307659
#delay.h2 <- lmer(delay ~ (1|trt) + (1|sampleid) + (1|trt:sampleid) + (1|rep) + (1|rep:run), data = sum, REML = T)
#summary(delay.h2)
#2442.55/(2442.55 + 871.8/4 +3767.97/4) #0.6780
uniformity.h <- lmer(uniform ~ (1|trt) + (1|landrace.name) + (1|trt:landrace.name) + (1|rep) + (1|rep:run), data = sum, REML = T)
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
summary(uniformity.h)
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## summary from lme4 is returned
## some computational error has occurred in lmerTest
## Linear mixed model fit by REML ['lmerMod']
## Formula:
## uniform ~ (1 | trt) + (1 | landrace.name) + (1 | trt:landrace.name) +
## (1 | rep) + (1 | rep:run)
## Data: sum
##
## REML criterion at convergence: 9180.1
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.8682 -0.6730 -0.1452 0.3965 6.1499
##
## Random effects:
## Groups Name Variance Std.Dev.
## trt:landrace.name (Intercept) 285.83 16.906
## landrace.name (Intercept) 877.63 29.625
## rep:run (Intercept) 101.02 10.051
## rep (Intercept) 53.90 7.342
## trt (Intercept) 24.99 4.999
## Residual 3101.85 55.694
## Number of obs: 837, groups:
## trt:landrace.name, 68; landrace.name, 19; rep:run, 8; rep, 4; trt, 4
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 76.483 9.714 7.873
#832.25/(832.25 + 287.26/4 +3102.8/4) #0.495
877.63/(877.63+285.83/4+3101.85/4) #.5089
## [1] 0.5089038
#uniformity.h2 <- lmer(uniform ~ (1|trt) + (1|sampleid) + (1|trt:sampleid) + (1|rep) + (1|rep:run), data = sum, REML =T)
#summary(uniformity.h2)
#754.38/(754.38 + 487.51/4 +2696.66/4) #0.4865
rate.h <- lmer(rategerm ~ (1|trt) + (1|landrace.name) + (1|trt:landrace.name) + (1|rep) + (1|rep:run), data = sum, REML = T)
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
summary(rate.h)
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## summary from lme4 is returned
## some computational error has occurred in lmerTest
## Linear mixed model fit by REML ['lmerMod']
## Formula:
## rategerm ~ (1 | trt) + (1 | landrace.name) + (1 | trt:landrace.name) +
## (1 | rep) + (1 | rep:run)
## Data: sum
##
## REML criterion at convergence: -10131.7
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.1759 -0.5300 -0.0815 0.5818 5.1990
##
## Random effects:
## Groups Name Variance Std.Dev.
## trt:landrace.name (Intercept) 1.583e-07 3.979e-04
## landrace.name (Intercept) 3.956e-06 1.989e-03
## rep:run (Intercept) 1.794e-07 4.235e-04
## rep (Intercept) 7.281e-20 2.698e-10
## trt (Intercept) 2.192e-06 1.481e-03
## Residual 3.166e-06 1.779e-03
## Number of obs: 1045, groups:
## trt:landrace.name, 76; landrace.name, 19; rep:run, 8; rep, 4; trt, 4
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 0.0042909 0.0008879 4.833
#3.885e-06/(3.885e-06 + 1.575e-07/4 + 3.166e-06/4) #0.8238
3.956e-06/(3.956e-06+1.583e-07/4+3.166e-06/4) #.8264
## [1] 0.8263919
#rate.h2 <- lmer(rategerm ~ (1|trt) + (1|sampleid) + (1|trt:sampleid) + (1|rep) + (1|rep:run), data = sum, REML = T)
#summary(rate.h2)
#2.939e-06/(2.939e-06+2.869e-07/4+2.262e-06/4) #0.8218
percgerm.h <- lmer(perc_germ ~ (1|trt) + (1|landrace.name) + (1|trt:landrace.name) + (1|rep) + (1|rep:run), data = sum, REML = T)
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
summary(percgerm.h)
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## Warning: grouping factors with < 5 sampled levels may give unreliable
## estimates
## summary from lme4 is returned
## some computational error has occurred in lmerTest
## Linear mixed model fit by REML ['lmerMod']
## Formula:
## perc_germ ~ (1 | trt) + (1 | landrace.name) + (1 | trt:landrace.name) +
## (1 | rep) + (1 | rep:run)
## Data: sum
##
## REML criterion at convergence: -434.7
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.6827 -0.2212 0.0987 0.4837 2.9253
##
## Random effects:
## Groups Name Variance Std.Dev.
## trt:landrace.name (Intercept) 0.01292 0.11368
## landrace.name (Intercept) 0.01649 0.12840
## rep:run (Intercept) 0.00267 0.05168
## rep (Intercept) 0.00000 0.00000
## trt (Intercept) 0.04561 0.21356
## Residual 0.03268 0.18077
## Number of obs: 1045, groups:
## trt:landrace.name, 76; landrace.name, 19; rep:run, 8; rep, 4; trt, 4
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 0.7808 0.1134 6.887
#1.636e-02/(1.636e-02+1.291e-02/4+3.268e-02/4) #0.5894
0.01649/(0.01649+0.01292/4+0.03268/4) #.5912
## [1] 0.5912513
#percgerm.h2 <- lmer(perc_germ ~ (1|trt) + (1|sampleid) + (1|trt:sampleid) + (1|rep) + (1|rep:run), data = sum, REML = T)
#summary(percgerm.h2)
#9.173e-03/(9.173e-03+1.472e-02/4+2.614e-02/4) #0.4731
#####
#CORRELATION OF UNIVARIATE VARBIABLES
#####
library(Hmisc)
## Loading required package: Formula
##
## Attaching package: 'Hmisc'
## The following objects are masked from 'package:base':
##
## format.pval, units
library(corrplot)
## corrplot 0.84 loaded
rcorr <- rcorr(as.matrix(sum[c("perc_germ", "rategerm", "uniform", "delay")]))
flattenCorrMatrix <- function(cormat, pmat) {
ut <- upper.tri(cormat)
data.frame(
row = rownames(cormat)[row(cormat)[ut]],
column = rownames(cormat)[col(cormat)[ut]],
cor =(cormat)[ut],
p = pmat[ut]
)
}
flat_corr <- flattenCorrMatrix(rcorr$r, rcorr$P)
corrplot(rcorr$r, type="upper", order="hclust", hclust.method = "centroid",
p.mat = rcorr$P, sig.level = 0.05, insig = "blank",
tl.col = "black")
title(main ="Pearson Correlation Matrix", sub = "size and color of circles related to
the correlation strength,
correlations where p<0.05 left blank")
